2010-07-30 3 views
0

노드가 XSLT의 다른 노드에 포함되어 있거나 다른 노드에 포함되어 있는지 확인할 수 있습니까?노드가 XSLT의 다른 노드에 포함되어 있는지 확인

<xsl:variable name="itemSection" select=".."/> 
<xsl:for-each select="key('enemyItems', @key)"> 
    <xsl:variable name="enemyList" select="./attributes/@value"/> 
    <xsl:variable name="enemyListSection" select="../../.."/> 
         . 
         . 
         . 
</xsl:for-each> 

이 itemSection이 포함 (또는 동일) enemyListSection 여부를 알 수 있나요 예를 들어, 다음 코드를 고려? XPath에에서

+0

Dimitre 정답을 확인하십시오. 나는 "(또는 동등한) 부분"을 놓쳤다. –

답변

2

1.0

$itemSection[ancestor::*[generate-id()=generate-id($enemyListSection)]] 

의 XPath 2.0

$itemSection[ancestor::*[. is $enemyListSection]] 
+0

답변의 정확성에 대한 저의 작은 공헌을보십시오. :) –

1

알레한드로의 대답에 그냥 작은 조정에서 : XPath는 1.0에서

$itemSection[ancestor-or-self::*[generate-id()=generate-id($enemyListSection)]] 
원래의 질문이 질문 때문에

$itemSection[ancestor-or-self::*[. is $enemyListSection]] 

의 XPath 2.0

:

이 itemSection은 ( 동일 또는 ) enemyListSection에 포함되어 있는지 여부를 알 수 있습니까?

+0

중요한 "(또는 동등한)"을 놓쳤습니다. 당신 것이 맞습니다. –

관련 문제