The input xml
<bill>
<bill_detail>
<detail type="T1" heading="PS">
<section type="T1" heading="P1" sub_heading="A">
<data_line type="T1">
<text1>Employees</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<total_line type="T1">
<text1>Total</text1>
<text3>1</text3>
<text4>2</text4>
<text5>3</text5>
</total_line>
</section>
<section type="T1" sub_heading="B">
<data_line type="T1">
<text1>Single</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<data_line type="T1">
<text1>Family</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<total_line type="T1">
<text1>Total</text1>
<text3>1</text3>
<text4>2</text4>
<text5>3</text5>
</total_line>
</section>
<section type="T1" sub_heading="C">
<data_line type="T1">
<text1>Employees</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<total_line type="T1">
<text1>Total</text1>
<text3>1</text3>
<text4>2</text4>
<text5>3</text5>
</total_line>
</section>
<section type="T1" heading="P2" sub_heading="A">
<data_line type="T1">
<text1>Employees</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<total_line type="T1">
<text1>Total</text1>
<text3>1</text3>
<text4>2</text4>
<text5>3</text5>
</total_line>
</section>
<section type="T1" sub_heading="B">
<data_line type="T1">
<text1>Single</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<data_line type="T1">
<text1>Family</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<total_line type="T1">
<text1>Total</text1>
<text3>1</text3>
<text4>2</text4>
<text5>3</text5>
</total_line>
</section>
<section type="T1" sub_heading="C">
<data_line type="T1">
<text1>Employees</text1>
<text2>1</text2>
<text3>2</text3>
<text4>3</text4>
<text5>4</text5>
</data_line>
<total_line type="T1">
<text1>Total</text1>
<text3>1</text3>
<text4>2</text4>
<text5>3</text5>
</total_line>
</section>
</detail>
</bill_detail>
</bill>
The output i am looking for is
- For the section which has sub_heading="A" and heading="P1" find the 2 sections below it with sub_heading="B" and sub_heading="C"
- The xpath expression should still hold good if change the heading to P2. It should be able to give the sections below the node which has the heading which is given as input.
What i have tried so far -
Aucun commentaire:
Enregistrer un commentaire