[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:copy

Subject: Re: xsl:copy
From: Keith Visco <kvisco@xxxxxxxxx>
Date: Fri, 09 Apr 1999 11:07:23 -0400
xsl copy context
Stefano,

xsl:copy, creates a copy of the context node and add the copy to the
result tree. xsl:copy can contain a template which will get processed if
the context node that is being copied is an element node.

If I have an element foo

<foo name="bar">foo data</foo>


The following template will add <foo/> to the result tree.

<xsl:template match="foo">
  <xsl:copy/>
</xsl:template>

The following template will add <foo name="bar"/> to the result tree.

<xsl:template match="foo">
  <xsl:copy>
     <xsl:for-each select="@*"><xsl:copy/></xsl:for-each>
  </xsl:copy>
</xsl:template>

The following template will add <foo name="bar">foo data</foo> to the
result tree.

<xsl:template match="foo">
  <xsl:copy>
     <xsl:for-each select="@* | text()"><xsl:copy/></xsl:for-each>
  </xsl:copy>
</xsl:template>


Note that if the context node is an element, attributes and children are
not automatically copied.

Also see the template for identity given as an example in the XSL WD.

--Keith

> Bovone Stefano wrote:
> 
> How works xsl:copy ?
> May I have any examples?
> 
> Thanks. Bye.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.