Hello,
I tried to figure this out myself and then I went to the Net but I am still stuck. Your assistance would be appreciated. Given the following XML content
I would like to create an XPath statement that will return, for example, where "Transport" is equal to train and "locale" is equal to North. My best guess, so far, is
but aside from the fact that it returns no matches, I get the sense that the second clause is incorrect in that it really does not equate to "and of the nodes that match the first criteria should also match the second".
This attempt returned all nodes that match "Train" but did not filter out the non-"North" locales.
What am I doing wrong?
Thanks for reading and Happy New Year.
I tried to figure this out myself and then I went to the Net but I am still stuck. Your assistance would be appreciated. Given the following XML content
Code:
<Data>
<ItemSet Id="aList">
<Row Id="1">
<Item Id="Transport">Plane</Item>
<Item Id="Type">Jet</Item>
<Item Id="Locale">Local</Item>
<Item Id="Rating">5</Item>
</Row>
<Row Id="2">
<Item Id="Transport">Train</Item>
<Item Id="Type">Diesel</Item>
<Item Id="Locale">North</Item>
<Item Id="Rating">9</Item>
</Row>
<Row Id="3">
<Item Id="Transport">Train</Item>
<Item Id="Type">Coal</Item>
<Item Id="Locale">North</Item>
<Item Id="Rating">12</Item>
</Row>
<Row Id="3">
<Item Id="Transport">Train</Item>
<Item Id="Type">Electricity</Item>
<Item Id="Locale">South</Item>
<Item Id="Rating">10</Item>
</Row>
</ItemSet>
</Data>
I would like to create an XPath statement that will return, for example, where "Transport" is equal to train and "locale" is equal to North. My best guess, so far, is
Code:
//Item[@Id="Transport"][.="Train" and Item[@Id="Locale"][.="North"]]
Code:
//Item[@Id="Transport"][.="Train" and //Item[@Id="Locale"][.="North"]]
What am I doing wrong?
Thanks for reading and Happy New Year.