Re: [xsl] apply-templates and predicates

Subject: Re: [xsl] apply-templates and predicates
From: "tom tom" <tomxsllist@xxxxxxxxxxx>
Date: Thu, 28 Apr 2005 10:40:24 +0100
Yes, I agree, thankyou - this is probably what I've been trying to articulate! Our input is not particularly variable which is probably why I've been favouring the former..

From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] apply-templates and predicates
Date: Wed, 27 Apr 2005 12:05:57 -0400

Hi Tom,

At 08:37 AM 4/27/2005, you wrote:
when applying templates it is possible to filter out unwanted nodes in a number of ways, one is by putting a predicate on the apply-templates command and use modes if you have more than one filter. Another is to apply-templates to all nodes and put a predicate on the template match - this avoids the use of modes.

...


Can anyone provide any more or provide advantages of doing the latter?

One advantage of the latter method is that it is more robust in the face of variable input. For example, if a source document comes in with an element that hasn't been explicitly accounted for, it will pass through and give you results for it, whereas in the former approach, it won't.


It makes the technique useful in generalized stylesheets that have to handle a range of kinds of input. For example, if I had a generic modification of the identity stylesheet whose only job was to filter out all elements of a given namespace (and their descendants), I'd probably do it that way.

Of course, this might be a bug, not a feature, depending on where you sit. Sometimes you don't want your output to be unpredictable even if your input is.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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 ======================================================================


_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger 7.0 today! http://messenger.msn.co.uk


Current Thread