xsl-list
[Top] [All Lists]

Re: [xsl] recursion

2011-02-18 03:51:03
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 Aufträgen durch den Bund;</absatz>
                </punkt>
                <listnum>b)</listnum>
                <punkt>
                   <absatz>der Vergabe von Aufträ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 
groß ist wie der der Länder;</absatz>
                </punkt>
                <listnum>bb)</listnum>
</nummerierte-liste>
<nummerierte-liste ebene="2">
                <listnum>f)</listnum>
                <punkt>
                   <absatz>der gemeinsamen Vergabe von Aufträgen durch den Bund und die 
Länder, wenn der Anteil des Bundes</absatz>
                </punkt>
                <listnum>g)</listnum>
                <punkt>
                   <absatz>der Vergabe von Aufträgen durch in lit. a bis f und Z 2 nicht 
genannte Rechtsträ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(_dot_)szabo(_at_)lexisnexis(_dot_)at
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>