I am struggling with some basic XSLT. I would like to remove an element from some XML depending on whether it has a certain attribute.
The XML looks like so:
<root>
<Request URL="www.google.com">
<id name="google"/>
</Request>
<Request URL="www.yahoo.com">
<id name="yahoo"/>
</Request>
</root>
I would like to remove the Request element if the URL is "www.google.com" and also to remove the element and the , so I would end up with the following:
<root>
<Request URL="www.yahoo.com">
<id name="yahoo"/>
</Request>
</root>
I have the following so far, but it isn't working:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--identity template copies everything forward by default-->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!--empty template suppresses this attribute-->
<xsl:template match="Request[@Url='www.google.com']"/>
</xsl:stylesheet>