2016-11-16 9 views
0

子ノードのいずれかがすべての条件を満たすかどうかによってノードをフィルタリングする必要があります。私はtestは、両方の条件のために同じノードを参照する必要が同じ子ノードのXPath複数条件

<root> 
    <grp pos="1"> 
     <test pos="1" id="2"/> 
     <test pos="2" id="1"/> 
     <test pos="3" id="1"/> 
     <test pos="4" id="2"/> 
     <test pos="5" id="1"/> 
    </grp> 
    <grp pos="2"> 
     <test pos="6" id="1"/> 
     <test pos="7" id="2"/> 
     <test pos="8" id="1"/> 
     <test pos="9" id="1"/> 
     <test pos="10" id="2"/> 
    </grp> 
</root> 

とXSL

<xsl:template match="/root"> 
    <xsl:value-of select="grp[test/@pos='1' and test/@id='1']/@pos"/> 
</xsl:template> 

:ここexempleです。私が望むのは、条件を渡すのにgrpノードを持たないことですが、最初の条件を渡す子ともう1つを通過する子があるため、最初の条件が実行されます。私は述語が両方を通過する子供を必要としたい。

答えて

0

[OK]を、私は知りませんでしたが、あなたが巣の述語ができそうです。これは私が

欲しいもの

<xsl:value-of select="grp[test[@pos='1' and @id='1']]/@pos"/>

を行います

関連する問題