Re: [xsl] copy and translate an element and its children

Subject: Re: [xsl] copy and translate an element and its children
From: "Matthew L. Avizinis" <mla@xxxxxxxxx>
Date: Thu, 03 Jul 2003 15:29:47 -0400


J.Pietschmann wrote:

Matthew L. Avizinis wrote:

Hello,
 I am currently using
               <xsl:variable name="short-title">
                     <xsl:for-each select="title/node()">
                       <xsl:if test="not(position()=1)">
                         <xsl:copy-of select="."/>
                       </xsl:if>
                     </xsl:for-each>
               </xsl:variable>
This copies all nodes unchanged.


Isn't it better to use
 <xsl:variable name="short-title"
    select="title/node()[position() &gt; 1]"/>
Avoids copying.

Well, that's what I thought at first when I tried it before copy-of, but apparently all the child element attributes are not copied. I needed a deep copy so that's why I used copy-of. Thanks for your suggestions.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread