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:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/xml">
<xsl:apply-templates select="test"/>
</xsl:template>
<xsl:template match="test">
<xsl:call-template name="FindCountry">
<xsl:with-param name="countries" select="normalize-space(countries/text())"/>
<xsl:with-param name="country" select="normalize-space(country/text())"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="FindCountry" xml:space="default">
<xsl:param name="countries" />
<xsl:param name="country" />
Is <xsl:value-of select="$country" /> in <xsl:value-of select="$countries" /> ?
<xsl:choose>
<xsl:when test="contains(concat(', ', $countries, ', '),
concat(', ', $country, ', '))">
<xsl:text>IN</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>OUT</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
To the XML
<xml>
<test>
<countries>
EG, KSA, UAE, AG
</countries>
<country>
UAE
</country>
</test>
<test>
<countries>
GBR, USA, DE, JP
</countries>
<country>
AUS
</country>
</test>
</xml>
Result
Is UAE in EG, KSA, UAE, AG ? IN
Is AUS in GBR, USA, DE, JP ? OUT
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…