[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem with xsl:template using XSLT 1.0

Subject: Re: Problem with xsl:template using XSLT 1.0
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 4 Dec 2007 12:08:55 +0000
Re:  Problem with xsl:template using XSLT 1.0
On 04/12/2007, David Carlisle <davidc@xxxxxxxxx> wrote:
> <xsl:apply-templates select="some-nodes[@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[@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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.