I have an xml and want to filter out sections that I do not need. Here is the xml & respective expected out put,
<CD>
<RT></RT>
<author></author>
<component>
<structurebody>
<component>
<section>
<templateid root = "1" />
</section>
</component>
<component>
<section>
<templateid root = "2" />
</section>
</component>
<component>
<section>
<templateid root = "3" />
</section>
</component>
</structurebody>
</component>
</CD>
I want the output to contain sections with template id's 1 and 3 not 2. I am trying the following xslt but it does not work. It outputs everything. Not sure what is wrong
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/component/structuredBody/component/section/templateId[not(@root = '1' or @root = '3')]" />
</xsl:stylesheet>
Can anyone let me know where am I making a mistake? Appreciate your help.