[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:copy
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|