Subject: Re: xsl:copy From: Keith Visco <kvisco@xxxxxxxxx> Date: Fri, 09 Apr 1999 11:07:23 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
xsl:copy, Bovone Stefano | Thread | Illustration of Different Node Tree, G. Ken Holman |
xsl:copy, Bovone Stefano | Date | Illustration of Different Node Tree, G. Ken Holman |
Month |