i have the following xml input
<RS>
<SAvailRQ>
<Code>AL</Code>
<FNum>131</FNum>
</SAvailRQ>
<SMapRS>
<SMapResponses>
<SMapResponse>
<SegInfo FNum="131">
<Departure LocationCode="MIA"/>
<Arrival LocationCode="LAX"/>
<Marketing Code="AL"/>
</SegInfo>
</SMapResponse>
<SMapResponse>
<SegInfo FNum="118">
<Departure LocationCode="LAX"/>
<Arrival LocationCode="MIA"/>
<Marketing Code="AL"/>
</SegInfo>
</SMapResponse>
</SMapResponses>
</SMapRS>
</RS>
I need logic such that if RS/SAvailRQ/FNum matches that found in RS/SMapRS/SMapResponses/SMapResponse/SegInfo/@FNum
to call a template to build an Info node on that match only.
Currently, I have the following
<xsl:apply-templates select="SMapResponses/SMapResponse/SegInfo"/>
but this loops twice (bc there are 2 SegInfo), I do not want that. I just want it to go into this template for the matching record(s) and then process data for that matching record only.
So how do I apply a for-each statement that will find matching FNum in SAvailRQ with that in SMapResponse and have that template called for that instance(s) only?
basically a filter.
if possible, can you please explain how the ancestor feature works in this case?