同様の問題: XPath: select a node based on another node?XSL述語を使用して、別のノードの値に基づいてノードを選択し、この質問へ
オブジェクトは、兄弟ノード、この場合PAGETITLEノードの値に基づいてノードを選択することですPagetypeノードの値に基づいています。
のXPath:
/dsQueryResponse/Rows/Row/@Title
/dsQueryResponse/Rows/Row/@Pagetype
/dsQueryResponse/Rows/Row/@Pagetitle
このXSLは何も返しません。
<xsl:value-of select= "/dsQueryResponse/Rows/Row[Pagetype='Parent']/@Pagetitle" />
サンプルXML:その場合
<dsQueryResponse>
<Rows>
<Row>
<Title>1</Title>
<Pagetype>Parent</Pagetype>
<Pagetitle>title of page</Pagetitle>
</Row>
</Rows>
</dsQueryResponse>
目標は、ページタイトルの値を持つことであるが返さPagetypeの値が「Parent」である。
入力XMLのサンプルを表示して、どのノードを選択するかを説明してください。現在の述語 '[Pagetype = 'Parent']'は、 'Parent'という値を持つ' Pagetype'という名前の子要素をチェックします。 –
@Martin xmlのサンプルを追加し、選択したいノードを明確にしようとしました。 – matt