Suppose I have XML like this:
<child_metadata>
<metadata>
<attributes>
<metadata_key value="include"/>
<metadata_value value="value1"/>
</attributes>
</metadata>
<metadata>
<attributes>
<metadata_key value="dont_include"/>
<metadata_value value="value2"/>
</attributes>
</metadata>
<metadata>
<attributes>
<metadata_key value="include"/>
<metadata_value value="value3"/>
</attributes>
</metadata>
</child_metadata>
Using XSLT (without any extensions), I want to select only those values for which the metadata_key is “include”. So, for this example, I want to select value1 and value3.
How do I do this?
The XPath expression to use (for a template or in a for-each loop) would be:
Since it isn’t clear what you mean by “select” I cannot post a complete XSLT sample. XSLT is for transformation, not query (“selection” of data); the query is done with XPath expressions such as the one I provided you above.