Re: [xsl] combining node restrictions in select statements

Subject: Re: [xsl] combining node restrictions in select statements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 28 Mar 2006 13:46:42 +0100
 select="/root/a[d[starts-with(e, 'A')]] and a[not(b=following::a/b)]" 

that is legal XPath but it's a boolean valued expression returning
true() or false(), also the a after the and will select child elements
of the current node, not the same element as selected by /root/a before
the and. However you wantto select nodes not return a boolean, I think
you want to do something like



 select="/root/a[d[starts-with(e, 'A')] and  not(b=following::a/b)]" 

so now the boolean valued expression
   d[starts-with(e, 'A')] and  not(b=following::a/b)
is just used as a predicate to filter /root/a

Note however that for each a you select you also select following::a so
this is rather inefficient if you have a lot of a's in the list.

google for muenchian grouping (especially on jeni tennison's site) for
techniques to make that more efficient.

Or in xslt2 you will be able to use xsl:for-each-group which is rather
easier to use.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread