tesmc
asked on
XSL - loop and if attribute contains text then store that
I have the following xml input
<Envelope>
<Body>
<Travel>
<Itinerary>
<Ticket Limit="T-05SEP" />
<Ticket Number ="TS 12345 SMITH/JOHN" />
<Ticket Number ="TK 66777 SMITH/JOHN" />
</Itinerary>
</Travel>
</Body>
</Envelope>
I want to loop through each Ticket node and if the @Number contains "TK" then return that value and place it in <xsl:attribute name="DocNum"> inside <References>
So output should be:
<References @DocNum="66777">
<Envelope>
<Body>
<Travel>
<Itinerary>
<Ticket Limit="T-05SEP" />
<Ticket Number ="TS 12345 SMITH/JOHN" />
<Ticket Number ="TK 66777 SMITH/JOHN" />
</Itinerary>
</Travel>
</Body>
</Envelope>
I want to loop through each Ticket node and if the @Number contains "TK" then return that value and place it in <xsl:attribute name="DocNum"> inside <References>
So output should be:
<References @DocNum="66777">
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
welcome
ASKER