XSLT : Exclude one NODE in Template

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ganesh Muthuvelu

    #1

    XSLT : Exclude one NODE in Template

    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:styleshe et 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="service InstanceProfile "/>
    <xsl:copy-of select="enableV ideo"/>
    </xsl:template>

    <xsl:template match="serviceI nstanceProfile" >
    <serviceInstanc eProfile>
    <xsl:copy-of select = "child::*[text()!='alias']"/>
    </serviceInstance Profile>
    </xsl:template>

    </xsl:stylesheet>
  • Martin Honnen

    #2
    Re: XSLT : Exclude one NODE in Template



    Ganesh Muthuvelu wrote:

    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']" />

    --

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

    Comment

    Working...