Select a XML node based on priority

Zer0x

New Member
I have the following XML, that need to parsed using XSLT,\[code\]<PERSONS> <PERSON> <TYPE>F</TYPE> <NAME>ABC</NAME> </PERSON> <PERSON> <TYPE>A</TYPE> <NAME>XYA</NAME> </PERSON> <PERSON> <TYPE>S</TYPE> <NAME>AFF</NAME> </PERSON> <PERSON> <TYPE>B</TYPE> <NAME>HHH</NAME> </PERSON></PERSONS>\[/code\]In the above XML, PERSON type can come in any order and i need the output as follows,\[code\]<SELECTED> <NAME>TEXT</NAME></SELECTED>\[/code\]The rule is that we need to display the name based on the following priority,A, F, S.If type A does not exists, check for type F and display the name if exists or else display type S name.Also it is possible that other types like B and C will come in the input XML but we need to ignore those types and only priority goes to A,F and S.Thanks in Advance,Wilson.
 
Back
Top