Similar problem to this question: XPath: select a node based on another node?
The object is to select a node based on the value of a sibling node-in this case the Pagetitle node based on the value of the Pagetype node.
xpaths:
/dsQueryResponse/Rows/Row/@Title
/dsQueryResponse/Rows/Row/@Pagetype
/dsQueryResponse/Rows/Row/@Pagetitle
This xsl isn't returning anything:
<xsl:value-of select= "/dsQueryResponse/Rows/Row[Pagetype='Parent']/@Pagetitle" />
Sample xml:
<dsQueryResponse>
<Rows>
<Row>
<Title>1</Title>
<Pagetype>Parent</Pagetype>
<Pagetitle>title of page</Pagetitle>
</Row>
</Rows>
</dsQueryResponse>
The goal is to have the values of Pagetitle returned if they have a Pagetype value of "Parent".
The @ sign denotes attributes of a node. So if you want to return the value of the attribute Pagetitle where the Pagetype attribute is equal to Parent, it should read:
A helpful resource I use to test my XPATH is http://www.xmlme.com/XpathTool.aspx