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

Re: recursion

Subject: Re: recursion
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 18 Feb 2011 09:50:50 +0000
Re:  recursion
On 18/02/2011 09:11, Szabo, Patrick (LNG-VIE) wrote:

You can find a worked example of a similar problem that extracts hierarchy information from level numbers in this paper:


The relevant code can be found by skipping to "process-level" and then reading the three paragraphs that introduce this code. This example is actually slightly more complex than yours because it allows extra elements between those that define the level numbers:

<line level="1"/>
<line level="2"/>
<line level="3"/>


Michael Kay

I'm using XSLT 2.0 and Saxon 9

I have this:

<nummerierte-liste ebene="1">
                   <absatz>Bundessache hinsichtlich</absatz>
<nummerierte-liste ebene="2">
                   <absatz>der Vergabe von AuftrC$gen durch den Bund;</absatz>
                   <absatz>der Vergabe von AuftrC$gen durch Stiftungen, Fonds und Anstalten im Sinne des Art. 126b Abs. 1;</absatz>
  <nummerierte-liste ebene="3">
                   <absatz>den, wenn der Finanzierungsanteil des Bundes mindestens gleich groC ist wie der der LC$nder;</absatz>
<nummerierte-liste ebene="2">
                   <absatz>der gemeinsamen Vergabe von AuftrC$gen durch den Bund und die LC$nder, wenn der Anteil des Bundes</absatz>
                   <absatz>der Vergabe von AuftrC$gen durch in lit. a bis f und Z 2 nicht genannte RechtstrC$ger;</absatz>
<nummerierte-liste ebene="1">
                   <absatz>Landessache hinsichtlich</absatz>

What i need to do is wrap it all up into one list.
@ebene tells us which layer the nummerierte-liste is in.
So a nummerierte-liste with @ebene="2"  should be a child of the last punkt of the first preceding nummerierte-liste with @ebene="1". A nummerierte-liste with @ebene="3" should be the child of the last punkt of the first-preceding nummerierte-liste with @ebene="2" and so on.

I know this has to be done with recursion but I'm just not good at this and i can't seem to figure it out.

Can anyone help me ?!

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
Marxergasse 25, 1030 Wien

Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146

Current Thread


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.
First Name
Last Name
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.