Subject: Re: [xsl] deep "copy-of" a source fragment From: Terence Kearns <terencek@xxxxxxxxxxxxxxxxxxx> Date: Thu, 05 Sep 2002 15:51:46 +1000 |
This works but only after I apply the namespaces as per the solution in my other post (replied to dave)
<xsl:template match="/"> <xsl:copy-of select="html/body/node()"/> </xsl:template>
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] deep "copy-of" a source f, Peter Davis | Thread | Re: [xsl] deep "copy-of" a source f, Peter Davis |
Re: [xsl] deep "copy-of" a source f, Terence Kearns | Date | Re: [xsl] deep "copy-of" a source f, Terence Kearns |
Month |