Hello all,
I want to exclude one node (element alone) but copy all of the other
elements. This is the XSLT I have. I want to exclude the "alias" element
alone but it does not work..
Can somebody help?
************
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @* "/>
</xsl:copy>
</xsl:template>
<xsl:template match="command">
<xsl:copy-of select="groupId"/>
<xsl:apply-templates select="serviceInstanceProfile"/>
<xsl:copy-of select="enableVideo"/>
</xsl:template>
<xsl:template match="serviceInstanceProfile">
<serviceInstanceProfile>
<xsl:copy-of select = "child::*[text()!='alias']"/>
</serviceInstanceProfile>
</xsl:template>
</xsl:stylesheet>
Martin Honnen - 20 Jul 2006 14:55 GMT
> I want to exclude one node (element alone) but copy all of the other
> elements. This is the XSLT I have. I want to exclude the "alias" element
> alone but it does not work..
If you have elements named alias then simply do
<xsl:template match="alias" />
and use the identity transformation template.
If you have an element with the text content 'alias' then do
<xsl:template match="*[text() = 'alias']" />
and use the identity transformation template. Depending on white space
you might want
<xsl:template match="*[normalize-space(text()) = 'alias']" />

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/