Re: [xsl] Performance Question: Expensive Functions in Predicates

Subject: Re: [xsl] Performance Question: Expensive Functions in Predicates
From: Eliot Kimber <ekimber@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 02 Jun 2004 15:10:32 -0500
My question is where, in general, is the best place to use these
functions:

- In apply-templates specifications?

- In match specifications?

- As IF blocks within templates?

I just stumbled onto a subtle (at least to me) difference between these two nominally equivalent forms:


<xsl:template match="foo[util:is_applicable()]">

and

<xsl:template match="foo">
  <xsl:if test="util:is_applicable()">


Which is that in the first case all *inapplicable* foo elements fall through to the default template, which if there's no explicit template for "foo", means that the content of foo will likely flow to the output, therefore failing to suppress inapplicable foo elements. Doh!


Given that, it suggests that putting the check in the match= value is the least attractive as it requires at least a single separate template with a lower priority to catch all elements that fail the applicability check, while doing the check at select time ensures that only applicable elements will be processed at all.

Cheers,

Eliot
--
W. Eliot Kimber
Professional Services
Innodata Isogen
9030 Research Blvd, #410
Austin, TX 78758
(512) 372-8122

eliot@xxxxxxxxxxxxxxxxxxx
www.innodata-isogen.com


Current Thread