ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error

[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: number continuation problem

Subject: Re: number continuation problem
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 30 Jun 2003 17:50:02 +0100
Re:  number continuation problem
Hi Andrew,

> A new twist is that there can be many <elseif>'s to an <if>
> (naturally enough), so the data can take the form:
>
> <if/>
> <elseif/>
> <elseif/>
> <elseif/>
> <if/>
> <elseif/>
>
> Is there a neat trick of getting all following-siblings while they
> are of a certain name (as if they are processed linearly).

In XSLT 1.0, use a key: index all the <elseif> elements by their
immediately preceding <if> element:

<xsl:key name="elseifs" match="elseif"
         use="generate-id(preceding-sibling::if[1])" />

Then, when on an <if> element, you can get all the related <elseif>
elements with:

  key('elseifs', generate-id(.))

Or you can just do it with:

  following-sibling::elseif[generate-id(preceding-sibling::if[1]) =
                            generate-id(current())]

Or you can step through them one-by-one recursively.
                            
Note that your solution:

  following-sibling::elseif[not(preceding-sibling::if[2])]

collects together all the <elseif> elements that have 0 or 1 preceding
sibling <if> elements. So, for example, if you're on the second <if>
of the example above, it won't select the following <elseif> because
it does have a second preceding sibling <if> element.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.