AW: [xsl] recursion

Subject: AW: [xsl] recursion
From: "Szabo, Patrick \(LNG-VIE\)" <patrick.szabo@xxxxxxxxxxxxx>
Date: Fri, 18 Feb 2011 10:52:53 +0100
Thanks a lot, i'll take a look at it.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT-Entwickler
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.szabo@xxxxxxxxxxxxx
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146


-----UrsprC<ngliche Nachricht-----

Von: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Gesendet: Freitag, 18. Februar 2011 10:51
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re: [xsl] 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:

http://www.saxonica.com/papers/ideadb-1.1/mhk-paper.xml

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"/>
<data/>
<data/>
<line level="2"/>
<data/>
<line level="3"/>

etc.

Michael Kay
Saxonica
> Hi,
>
> I'm using XSLT 2.0 and Saxon 9
>
> I have this:
>
> <nummerierte-liste ebene="1">
>                 <listnum>1.</listnum>
>                 <punkt>
>                    <absatz>Bundessache hinsichtlich</absatz>
>                 </punkt>
> </nummerierte-liste>
> <nummerierte-liste ebene="2">
>                 <listnum>a)</listnum>
>                 <punkt>
>                    <absatz>der Vergabe von AuftrC$gen durch den
Bund;</absatz>
>                 </punkt>
>                 <listnum>b)</listnum>
>                 <punkt>
>                    <absatz>der Vergabe von AuftrC$gen durch Stiftungen,
Fonds und Anstalten im Sinne des Art. 126b Abs. 1;</absatz>
>                 </punkt>
>   </nummerierte-liste>
>   <nummerierte-liste ebene="3">
>                 <listnum>aa)</listnum>
>                 <punkt>
>                    <absatz>den, wenn der Finanzierungsanteil des Bundes
mindestens gleich groC ist wie der der LC$nder;</absatz>
>                 </punkt>
>                 <listnum>bb)</listnum>
> </nummerierte-liste>
> <nummerierte-liste ebene="2">
>                 <listnum>f)</listnum>
>                 <punkt>
>                    <absatz>der gemeinsamen Vergabe von AuftrC$gen durch den
Bund und die LC$nder, wenn der Anteil des Bundes</absatz>
>                 </punkt>
>                 <listnum>g)</listnum>
>                 <punkt>
>                    <absatz>der Vergabe von AuftrC$gen durch in lit. a bis f
und Z 2 nicht genannte RechtstrC$ger;</absatz>
>                 </punkt>
> </nummerierte-liste>
> <nummerierte-liste ebene="1">
>                 <listnum>2.</listnum>
>                 <punkt>
>                    <absatz>Landessache hinsichtlich</absatz>
>                 </punkt>
> </nummerierte-liste>
>
> 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
>   XSLT-Entwickler
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.szabo@xxxxxxxxxxxxx
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

Current Thread