XPath Tester and Node Selecting examples
Free XPath Tester Site.
Example XML
<listingAgent id="1"> <name>Sandra Oh</name> <telephone type="mobile">0400 000 000</telephone> <telephone type="BH">1300 123 456</telephone> <email>sandra@test.com</email> <office_id>SANDRA-OFFICE</office_id> <agentFirstName>Sandra</agentFirstName> <agentLastName>Oh</agentLastName> <agentUserName>sandra-oh</agentUserName> </listingAgent>
Select a node where the type is BH irrespective of order.
{telephone[@type='BH']}
When the type is mobile irrespective of order.
{telephone[@type='mobile']}