Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: selecting a range of nodes

From: Pavel Lepin <p.lepin@-------.--->
To: NULL
Date: 8/3/2007 12:58:00 PM


Andy Fish <ajfish@b...> wrote in
<joCsi.15392$7c.10352@f...>:
> <top>
>     <a1/>
>     <a2/>
>     <foo/>
>     <a3/>
>     <a4/>
>     <a5/>
>     <a6/>
>     <bar/>
>     <a7/>
>     <a8/>
> </top>
> 
> now, inside this template
> 
> <xsl:template match="foo">
> 
> I would like to select all the nodes up to the following
> <bar> (if there are several <bar>s it would be the next
> one)

The need to do that often indicates a problem with the
design of your XML document.

> it seems quite simple on the face of it but I can't figure
> out any way to get close at the moment

Read up on generate-id() and current():

  following-sibling::*
  [
    generate-id(following-sibling::bar)=
    generate-id(current()/following-sibling::bar)
  ]

Note that using keys may result in a significant performance
boost.

-- 
...the pleasure of obedience is pretty thin compared with
the pleasure of hearing a rotten tomato hit someone in the
rear end. -- Garrison Keillor


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