xsl-list
[Top] [All Lists]

Re: copy and translate an element and its children

2003-07-03 12:29:47


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



<Prev in Thread] Current Thread [Next in Thread>