편집
귀하의 게시물을 다시, 나는 내 대답 (아래)의 원본 버전이 아닌 것 같아요.
당신 이미에게 목록을 가지고 - 당신의 변수 선언은 선택하는 노드 집합 <Request>
의 아이들 (노드 - 세트/목록 배열의 XSLT에 해당합니다) 모든 <country>
노드 :
<xsl:variable name="$country" select="Request/country" >
하지만 요점은 도 필요하지 않습니다.이 목록은 별도의 변수로 표시되는입니다. 당신이 필요로하는 모든입니다 Request[country=$country]
같이 읽어
<xsl:when test="Request[country=$country]"><!-- … --></xsl:when>
"모든 <country>
보고는 $country
동일한 경우 선택, <Request>
내." 표현식이 비어 있지 않은 노드 집합을 반환하면 $country
이 목록에 있습니다.
사실 Rubens Farias가 처음부터 말한 것은 사실입니다. :)
원본 답변은 기록에 보관됩니다.
<!-- instead of a variable, this could be a param or dynamically calculated -->
<xsl:variable name="countries" select="'EG, KSA, UAE, AG'" />
<xsl:variable name="country" select="'KSA'" />
<xsl:choose>
<!-- concat the separator to start and end to ensure unambiguous matching -->
<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>
</xsl:choose>
그 목록이 XML 입력에 속하는 :
은 "목록"에 의한 경우 토큰의 쉼표로 구분 된 문자열을 의미합니까? –
입력 XML은 어떤 형식입니까? 국가 코드 텍스트 노드 하위 또는 요소입니까? 속성? –
jelovirt