This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: deep "copy-of" a source fragment
Please see post in response to Dave on the resolution to my problem...
I've included responses to this email below...
Peter Davis wrote:
<xsl:template match="/">
<xsl:copy-of select="html/body/node()"/>
</xsl:template>
This works but only after I apply the namespaces as per the solution in
my other post (replied to dave)
An alternative to using copy-of is to use the "identity template", which can
look something like this (untested):
<!-- ignore all nodes unless otherwise specified -->
<xsl:template match="node()" priority="0"/>
<xsl:template match="/html/body//@* | /html/body//node()">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
You might want to go this route if you ever want to apply other templates to
specific elements in the /html/body//* tree. Using xsl:copy-of doesn't allow
you to modify the output of the copy with other templates. If you don't
think you'll ever need to apply other templates, then copy-of should work
fine.
Ah yes, I _will_ be attempting to apply other template rules to the
content so I will definately take your advice on this one. Now that I
have the namespaces sorted out, I should be able to easily apply the
identity transformation method. Thanks for the tip!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list