Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] select immediately following siblings with constraints?

From: "Michael Kay" <mike@------------>
To:
Date: 2/23/2006 7:14:00 PM
> XPath gives 
> no way to look along an axis up to a particular point and no further. 
> (Well, actually I shouldn't say this categorically about XPath 2.0 
> without giving it some good hard thought first, or inviting others to 
> demonstrate a method. :-) 

Let's say you want all the nodes on a forwards axis X up to and excluding
the first one that satisfies condition PRED. Then you can write

for $stop in x::node()[PRED][1] return x::node()[.<<$stop]

substituting >> if it's a reverse axis. If you want to include the stop
node, 

return (x::node()[.<<$stop], $stop)

It's not vastly elegant - this is one of those things that could have been
done so much better with higher-order functions - but it's workable. It's
not too difficult to optimize, either, though Saxon doesn't attempt this
currently.

Michael K


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent