xsl-list
[Top] [All Lists]

Re: [xsl] The identity transform and attributes

2008-01-21 10:16:06
On 21/01/2008, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:

Here's the/a long version that works in both XSLT 1.0 and 2.0:

    <xsl:template match="child::*">
        <xsl:copy>
            <xsl:apply-templates select="attribute::*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template
match="attribute::*|text()|comment()|processing-instruction()">
        <xsl:copy/>
    </xsl:template>

Here's a version that might be more understandable to a beginner (IMHO):

     <xsl:template match="child::*">
         <xsl:copy>
             <xsl:apply-templates select="attribute::*|child::node()"/>
          </xsl:copy>
     </xsl:template>

     <xsl:template
match="attribute::*|text()|comment()|processing-instruction()">
         <xsl:copy/>
     </xsl:template>

--~------------------------------------------------------------------
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>
--~--