Below is a good example, but how can I store values dynamically....Could you please explain?
<xsl:variable name="countries" select="'EG, KSA, UAE, AG'" />
<xsl:variable name="country" select="'KSA'" />
<xsl:choose>
<xsl:when test="
contains(
concat(', ', normalize-space($countries), ', ')
concat(', ', $country, ', ')
)
">
<xsl:text>IN</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>OUT</xsl:text>
</xsl:otherwise>
Look good....I have some another requirement. Could you please look into this?
<xml>
<test>
<BookID>
0061AB
</BookID>
<amount>
16
</amount>
</test>
<test>
<BookID>
0062CD
</BookID>
<amount>
2
</amount>
</test>
<test>
<BookID>
0061AB
</BookID>
<amount>
2
</amount>
</test>
</xml>
here According to the equal value of BookID, I want to add the amount value.....like for above example, if value of BookID is 0061AB, then the value of amount should be 18.
As others have mentioned, your question isn't very clear, but you can use a call template to reuse your 'country find' algorithm across an xml document containing both the candidate country and the search list (you could also use
document
to load split the candidate and search target into separate xml documents)e.g. when applying the XSLT:
To the XML
Result