At 2009-10-15 13:58 -0400, Syd Bauman wrote:
Michael --
So you're saying that you prefer
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
to
<xsl:template match="@*|*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
Those are different, Syd, so not interchangeable.
The first does not give the identity template stylesheet an
opportunity to intervene on a particular attribute node being pushed
at the stylesheet. This would be done with a:
<xsl:template match="@abc">.....
for the cases where attribute processing is minimal, right? May I ask
if that is because it's more efficient, more elegant, more XSLT-ish,
or just personal preference?
Thanks!
-- Syd, who always uses:
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
Note that I learned from Mike that the XSLT 2 way of doing the
identity template is different still:
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*,node()"/>
</xsl:copy>
</xsl:template>
Note the use of the "," instead of "|" as this apparently prevents
the need for the processor to arrange the nodes in document
order. Not a big savings, but a savings nonetheless.
We all learn a lot from Mike!
. . . . . . . . . . . . Ken
--
Upcoming: hands-on code list, UBL, XSLT, XQuery and XSL-FO classes
in Copenhagen Denmark and Washington DC USA, October/November 2009
Interested in other classes? http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--