xsl-list
[Top] [All Lists]

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

2007-12-04 05:09:32
On 04/12/2007, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
<xsl:apply-templates select="some-nodes[(_at_)id=current()/@id]"/>

for example can't so easily be moved down on to the match.

Good point - that's also a good example to highlight what I was
thinking earlier - when it comes to maintaining a stylesheet is it
nicer to have:

<xsl:template match="some-nodes[(_at_)id = $someID]">...

or just

<xsl:template match="some-nodes">

...where the filter is done at select time?  The intended use for the
template is much more explicit in the former - when you edit that
template in the future you know it doesn't get applied to all
<some-nodes/>, and you won't be left scratching your head wondering
why the template hasn't fired.

I guess you can do it in both places - it kind of fits with the 2.0
philosophy of being as restrictive as possible.


Looking down my stylesheets I seem to use both ways (and for-each (and
more and more, for-each-group) in about equal measure.

Yep, I would say I do a mix of them all too, for no particular reason.


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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>
--~--