Pz Help Simple XSL filter
hi all,
i try to write a simple filter using xsl. This is my test xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<data name="aaa">
<foo/>
</data>
<data name="xxx">
<foo/>
</data>
</root>
I desire to produce this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<data name="aaa">
<foo/>
</data>
</root>
whitout node with name=xxx, i try this xsl but don't work:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
<xsl:output method="xml"/>
<xsl:variable name="prima">
<xsl:copy-of select="*"/>
</xsl:variable>
<xsl:variable name="seconda">
<xsl:apply-templates mode="filtro"/>
</xsl:variable>
<xsl:template match="/">
<xsl:copy-of select="$seconda"/>
</xsl:template>
<xsl:template match="data" mode="filtro">
<xsl:if test="@name='aaa'">
<xsl:copy-of select="$prima"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
can someone help me plz?
ty to all