Reputation: 867
How to select in the following xml all elements by attribute 'type=a'?
<?xml version="1.0" encoding="ISO-8859-1"?>
<PLAYLIST>
<ITEM type="a">
<ARTIST>Pixies</ARTIST>
</ITEM>
<TEST>
<ARTIST type="a">Lambchop</ARTIST>
</TEST>
</PLAYLIST>
Upvotes: 0
Views: 218
Reputation: 116992
The XPath expression:
//*[@type="a"]
will select any element that has a type
attribute with the value of "a", anywhere in the XML document.
Note:
You have tagged this question as XSLT
. The answer above may or may not be useful in an XSLT stylesheet. It depends on what you want to accomplish by the transformation.
Upvotes: 1