Re: [xsl] Recursive?

Subject: Re: [xsl] Recursive?
From: Sven Waibel <sven.waibel@xxxxxxxx>
Date: Thu, 17 Mar 2005 15:30:19 +0100
Hi,
thanks.

I don't know how to get this recursion work.
I want to do a table of contents.

So i apply-templates match="tt" first to do my table of contents and then i would like to apply it a second time to get
my contents.

I'm so confussed!

Sven

Michael Kay wrote:

> Try
> 
> margin-left="{concat(string-length(numbering)-1,'mm')}"
> 
> Michael Kay
> http://www.saxonica.com/
> 
>  
> 
> 
>>-----Original Message-----
>>From: Sven Waibel [mailto:sven.waibel@xxxxxxxx] 
>>Sent: 17 March 2005 10:03
>>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>Subject: Re: [xsl] Recursive?
>>
>>I have a problem now.
>>
>>I count numbering to indent it.
>>
>>I did it this way
>>
>>margin-left="concat(string-length(numbering)-1,'mm')"
>>
>>but so i don't get the result.
>>
>>Sven
>>
>>Michael Kay wrote:
>>
>>
>>>Processing a recursive data structure should always be done 
>>
>>recursively.
>>
>>>I can't see anything in this requirement that can't be 
>>
>>satisfied by a
>>
>>>completely straightforward set of template rules using the standard
>>><xsl:apply-templates/> technique at each level to process 
>>
>>the children. If
>>
>>>you're struggling with it, it would be helpful to know where your
>>>difficulties are.
>>>
>>>Michael Kay
>>>http://www.saxonica.com/
>>> 
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Sven Waibel [mailto:sven.waibel@xxxxxxxx] 
>>>>Sent: 17 March 2005 08:56
>>>>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>>>Subject: [xsl] Recursive?
>>>>
>>>>Hi everybody,
>>>>
>>>>my xml:
>>>><?xml version="1.0" encoding="ISO-8859-15"?>
>>>><it>
>>>>	<tt id="20">
>>>>		<numbering>1</numbering>
>>>>		<name><![CDATA[test0]]></name>
>>>>		<tc id="4611686020000000015">
>>>>			<numbering>1.1</numbering>
>>>>			<name><![CDATA[test1]]></name>
>>>>		</tc>
>>>>	</tt>
>>>>	<tt id="21">
>>>>		<numbering>2</numbering>
>>>>		<name><![CDATA[test2]]></name>
>>>>		<tt id="22">
>>>>			<numbering>2.1</numbering>
>>>>			<name><![CDATA[test3]]></name>
>>>>			<tt id="23">
>>>>				<numbering>2.1.1</numbering>
>>>>				<name><![CDATA[tgf]]></name>
>>>>				<tc id="4611686020000000012">
>>>>					<numbering>2.1.1.1</numbering>
>>>>					<name><![CDATA[test4]]></name>
>>>>				</tc>
>>>>				<tc id="4611686020000000013">
>>>>					<numbering>2.1.1.2</numbering>
>>>>					<name><![CDATA[test5]]></name>
>>>>				</tc>
>>>>			</tt>
>>>>			<tc id="4611686020000000014">
>>>>				<numbering>2.1.2</numbering>
>>>>				<name><![CDATA[test6]]></name>
>>>>			</tc>
>>>>		</tt>
>>>>	</tt>
>>>></it>
>>>>
>>>>I want to get this:
>>>>
>>>>number name
>>>>
>>>>1 test0
>>>> 1.1 test1
>>>>2 test2
>>>> 2.1 test3
>>>>   2.1.1 test4
>>>>     2.1.1.1 test5
>>>>     2.1.1.2 test6
>>>>   2.1.2 test7
>>>>
>>>>
>>>>Should i do it recursively or is there a better way to achieve it?
>>>>
>>>>Thanks and best regards.
>>>>
>>>>Sven
>>>> 2.

Current Thread