Can anyone help with the following XPath question? Given the node-set:
<table>
<rows>
<row>
<value column="Product">Coal</value>
<value column="Quantity">10000</value>
</row>
<row>
<value column="Product">Iron</value>
<value column="Quantity">5000</value>
</row>
<row>
<value column="Product">Ore</value>
<value column="Quantity">4000</value>
</row>
</rows>
</table>
I want to query to find the node sub-set with a given product name. Note that the product name is being supplied by an attribute of the current node being processed (i.e. "@name"). So when the @name attribute has the value of "Coal" I would expect this to be returned:
<row>
<value column="Product">Coal</value>
<value column="Quantity">10000</value>
</row>
This is what I've come up with; I know it's wrong, because I don't get anything back.
$table/rows/row[value[@column='Product'][text()=@name]]
</code>