XSLT: Return results based on following sibling value

mrarka.com

New Member
I'am fairly new to XSLT. Any help would be appreciated ....\[code\]<Test> <loop loop_id="5" LoopElementOrder_no="1" Segment_id="3" > <usage_id>1</usage_id> <value>41</value> </loop> <loop loop_id="5" LoopElementOrder_no="2" Segment_id="3"> <usage_id>1</usage_id> <value>2</value> </loop> <loop loop_id="5" LoopElementOrder_no="4" Segment_id="3"> <usage_id>2</usage_id> <value>raj</value> </loop> <loop loop_id="5" LoopElementOrder_no="5" Segment_id="3"> <usage_id>3</usage_id> <value>d</value> </loop> <loop loop_id="5" LoopElementOrder_no="6" Segment_id="3"> <usage_id>3</usage_id> <value>8</value> </loop> <loop loop_id="5" LoopElementOrder_no="7" Segment_id="3"> <usage_id>3</usage_id> <value>7</value> </loop> <loop loop_id="5" LoopElementOrder_no="1" Segment_id="4"> <usage_id>1</usage_id> <value>IC</value> </loop> <loop loop_id="5" LoopElementOrder_no="2" Segment_id="4"> <usage_id>2</usage_id> <value>d</value> </loop> <loop loop_id="5" LoopElementOrder_no="3" Segment_id="4"> <usage_id>3</usage_id> <value>dm</value> </loop> <loop loop_id="5" LoopElementOrder_no="4" Segment_id="4"> <usage_id>2</usage_id> <value>wj</value> </loop> </Test>\[/code\]I would like to return the 'value' only if its usage_id is either 1 or 2. In case if the usage_id is 3 it should return "N/A".However, for example if am in Segment_id=3 LoopElementOrder_no=5 then the remaining of Segment_id=3 doesn't contains any Usage_id as 1 or 2 in which case i need to return "^" and continue the it from Segment_id=4 with LoopElementOrder_no=1. The desired output for the above is:\[code\]41 2 raj ^IC d N/A wj\[/code\]
 
Back
Top