Abie,
At 04:28 PM 9/22/2003, you wrote:
why does the standard identity transform use copy instead of copy-of?
Since it proceeds down the tree step by step, it is a trivial matter to
amend the identity transform with your own tree-tweaking logic:
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="broken">
<fixed>
<xsl:apply-templates select="@* | node()"/>
</fixed>
</xsl:template>
Put these two together and you get a stylesheet which takes arbitrary input
and returns it as the result -- except all <broken> elements, at any level,
are now <fixed>.
The copy-of method is, of course, more efficient if you actually need to
clone a subtree, rather than copy-it-mostly-except, which is what most
applications of an identity transform actually need to do.
Cheers,
Wendell
ie:
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
instead of just
<xsl:template match="/">
<xsl:copy-pf select="."/>
</xsl:template>
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list