I have the following xml:
<Reply>
<OptionInfoReply>
<Option>
<Opt>EDIFBEB </Opt>
<OptionNumber>4974</OptionNumber>
<OptAvail>-3 </OptAvail>
</Option>
<Option>
<Opt>CHSFBEB </Opt>
<OptionNumber>2664</OptionNumber>
<OptAvail>-3 </OptAvail>
</Option>
<Option>
<Opt>WESFBEB </Opt>
<OptionNumber>4196</OptionNumber>
<OptAvail>-3 </OptAvail>
</Option>
And anthoer XML which I used in for each :
<Reply>
<OptionInfoReply>
<Option>
<Opt>CHSFBEB</Opt>
<OptionNumber>3823</OptionNumber>
<OptionNotes>
<OptionNote>
<NoteCategory>XM</NoteCategory>
<NoteText>P2B</NoteText>
<LastUpdate>2010-11-03T15:33:18Z</LastUpdate>
</OptionNote>
</OptionNotes>
</Option>
</OptionInfoReply>
</Reply>
And I want to check in XSLT if the value of for each CHSFBEB from the second XML exists in the first xml.
<xsl:template match="/">
<db:InputParameters>
<db:P_RESPONSE_LINES>
<xsl:for-each select="/Reply/OptionInfoReply/Option">
<db:P_RESPONSE_LINES_ITEM>
<xsl:variable name="SearchOPT" select="Opt"/>
<db:AVAILABLE_ROOMS_NO>
<xsl:value-of select="$AVL/Reply/OptionInfoReply/Option/Opt[contains(.,$SearchOPT)]/../OptAvail"/>
</db:AVAILABLE_ROOMS_NO>
</db:P_RESPONSE_LINES_ITEM>
</xsl:for-each>
</db:P_RESPONSE_LINES>
</db:InputParameters>
</xsl:template>
However, if in the first XML I have more than one option, contains is not working.
No comments:
Post a Comment