[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] The identity transform and attributes


Subject: Re: [xsl] The identity transform and attributes
From: "Colin Adams" <colinpauladams@xxxxxxxxxxxxxx>
Date: Mon, 21 Jan 2008 17:15:39 +0000

On 21/01/2008, Abel Braaksma <abel.online@xxxxxxxxx> 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>


Current Thread
Keywords