-2

My input xml

<namelist>
 <order>
     <name>JAMES</name>
      <accNo>10D</accNo>
 </order>
 <order>
      <name>ARAFAT</name>
      <accNo>07A</accNo>
 </order>
 <order>
       <name>anotherbranchaccount</name>
       <accNo>20J</accNo>
 </order>
 <order>
       <name>JAMES</name>
       <accNo>20K</accNo>
 </order>
 <order>
      <name>JOHN</name>
      <accNo>9A</accNo>
 </order>
 <order>
      <name>anotherbranchaccount</name>
      <accNo>10E</accNo>
 </order>
</namelist>

Expected output
JAMES 10D ANOTHERACCOUNT 10E
ARAFAT 07A
JAMES 20K ANOTHERACCOUNT 20J

My problem

I got to match with 'anotherbranchaccount'element which 'accNo' is adjacent to JAMES 'accNo' .There is no sequence like main account number then extra account node. Give me solution. I dont have any idea about finding from alphanumeric format.because we have many alphanumeric comibanations like [A-Z][1 TO 100] How to solve this issue? Please help me out.

  • `Give me solution` -> No. If you want to do some XML parsing, it suggest you to read this thread : http://stackoverflow.com/questions/5059224/which-is-the-best-library-for-xml-parsing-in-java – Arnaud Denoyelle Aug 29 '13 at 12:03
  • No.Its not giving any solution.. – user2579370 Aug 29 '13 at 12:14
  • A DOM XML Parser will help you to navigate in you XML document. For example it will allow you to get all `` tags, then filter the ones which contain a tag `` which have inner text `JAMES`. – Arnaud Denoyelle Aug 29 '13 at 12:35

1 Answers1

0

This Regular Expression will return true for your account number format:

"(^[0-9]{1,2})+([a-zA-Z]{1})$"
John Hall
  • 1,346
  • 13
  • 27
  • Which function I got to use in this case? whether compare() or translate(). How can i compare with accNo? Please elaborate this,actually i am very new to xslt and beginner as well – user2579370 Aug 29 '13 at 15:55