Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Problem with xsl:template using XSLT 1.0

From: "Michael Kay" <mike@------------>
To:
Date: 12/5/2007 4:43:00 PM
>     Remember that your <xsl:template/> elements should match
>     fairly generically (match="player" in this case), and
>     your <xsl:apply-templates/> elements should be where you
>     narrow down your selection.
> 
>   I just say that in general, I would give instead the 
> opposite advice.  Of course, there is place for both 
> patterns, and I expect any not-simple-toy-stylesheet to use 
> both.  With experience, when using one or the other become 
> quite obvious.

To me the telltale sign that you've got it wrong is when the body of the
xsl:template rule consists of an xsl:choose instruction.

There are many cases where it really doesn't matter too much. For example,
"process all attributes except width and height" (which came up this
morning) can equally well be written as

<xsl:apply-templates select="@* except (@width, @height)"/>

or as <xsl:apply-templates select="@*"/> with

<xsl:template match="@width|@height"/>

There really isn't all that much to choose between them. However, if you're
only processing a very small proportion of the nodes, then selecting the
nodes to be processed in the select attribute of xsl:apply-templates will
probably be more efficient.

Michael Kay
http://www.saxonica.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent