I'm trying to remove an entire element, if the value of one of its
child elements equals x.
XML Input example:
<pets>
<animal>
<species>fish</species>
<environment>bowl</environment>
</animal>
<animal>
<species>cat</species>
<environment>house</environment>
</animal>
</pets>
XSLT Goal: Remove all animal elements if species=fish
XML Output desired:
<pets>
<animal>
<species>cat</species>
<environment>house</environment>
</animal>
</pets>
Here's my current XSL:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ead="urn:isbn:1-931666-22-9"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="xsl ead xlink xsi" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- Standard copy -->
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="pets/animal/species[text()='fish']"/>
</xsl:stylesheet>
But all my outputs still have fish. I'm using XSLT 1.0 and I'm having
a problem with the xpath, I think. My XML reference book is at work,
and I can't quite get the xpath syntax right, can someone point out my
error?
Many thanks,
Nathan
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--