Re: [xsl] Having Trouble With Condition For Default Nodeset Selection

Subject: Re: [xsl] Having Trouble With Condition For Default Nodeset Selection
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 Jul 2006 21:08:37 -0400
At 2006-07-05 10:49 +1000, Duncan Anker wrote:
On the use of "//",  the $currency-data comes
from a select="document(..)"  and so seems to be
required or I get no result set - although I can
probably fold the currency-data and codes into a
single select. Better pass me that mallet again. :)

When I teach my XSLT class I tell my students "if you think you need //, think again because you probably don't" because the use of "//" is the biggest unnecessary hit on XSLT processing *unless you really need to search each and every descendent down each and every subtree of the source node tree from the point where "//" is used*.

Note my emphasis.  I'm not saying it is evil ...
sometimes you really do need to search each and
every descendent ... but often you do not.  Many
new users of XSLT liberally use "//" thinking
that it will somehow stop at the items they are
looking for, not realizing that it goes below
anything it finds looking all the way to every
leave of every subtree looking for more of what is being looked for.

Perhaps you need something like "document(..)/*/codes".

For example, in UBL we are using code lists
expressed in genericode[1] and something like
"document(..)/*/SimpleCodeList/Row[Value/SimpleValue=$code]"
would be more efficient and less wasteful than
"document(..)//Row[Value/SimpleValue=$code]".

I hope this helps.

. . . . . . . Ken

--
Registration open for UBL training:    Montrial, Canada 2006-08-07
Also for XSL-FO/XSLT training:    Minneapolis, MN 2006-07-31/08-04
Also for UBL/XML/XSLT/XSL-FO training: Varo,Denmark 06-09-25/10-06
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread