I am trying in vain to develop a selection criterion that allows me to remove a node from an xml, or to create an xml that does not contain this node. The selection criterion should be a value somewhere below the node.
The example is simplified, but differs only from the node number and depth. In this example I want to remove all cars, which have 'VW' as manufacturer.
My (unsuccessful) attempts went roughly in the following direction:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<xsl:copy-of select="*[not(self::car[manufacturer = 'VW'])]"/>
</xsl:template>
</xsl:stylesheet>
original:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<cars>
<car>
<manufacturer>Audi</manufacturer>
</car>
<car>
<manufacturer>VW</manufacturer>
</car>
<car>
<manufacturer>Lada</manufacturer>
</car>
</cars>
</root>
aspired result:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<cars>
<car>
<manufacturer>Audi</manufacturer>
</car>
<car>
<manufacturer>Lada</manufacturer>
</car>
</cars>
</root>