RE: [xsl] Recursive?

Subject: RE: [xsl] Recursive?
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Thu, 17 Mar 2005 14:31:59 +0000
Sven, the following proposes indent depth depending on number of "ancestors" of a tt or tc node.

It doesn't match your output exactly, in that your output sample doesn't show "tgf" and shows "2.1.2 test7" for "2.1.2 test6"...but for now I'm assuming them typos.



<xsl:stylesheet xmlns:xsl=""; version="1.0">
<xsl:output method="text"/>

   <xsl:template match="tt|tc">
       <xsl:call-template name="indent">
           <xsl:with-param name="depth" select="count(ancestor::*) - 1"/>
           <xsl:with-param name="leadchar" select="'    '"/>

       <xsl:value-of select="numbering"/>
       <xsl:text> </xsl:text>
       <xsl:value-of select="name"/>


   <xsl:template name="indent">
       <xsl:param name="depth" select="0"/>
       <xsl:param name="leadchar" select="' '"/>

       <xsl:if test="$depth &gt; 0">
           <xsl:value-of select="$leadchar"/>

           <xsl:call-template name="indent">
               <xsl:with-param name="depth" select="$depth - 1"/>
               <xsl:with-param name="leadchar" select="$leadchar"/>

   <xsl:template match="text()">


Waibel <sven.waibel@xxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Recursive?
Date: Thu, 17 Mar 2005 09:56:03 +0100

Hi everybody,

my xml:
<?xml version="1.0" encoding="ISO-8859-15"?>
	<tt id="20">
		<tc id="4611686020000000015">
	<tt id="21">
		<tt id="22">
			<tt id="23">
				<tc id="4611686020000000012">
				<tc id="4611686020000000013">
			<tc id="4611686020000000014">

I want to get this:

number name

1 test0
  1.1 test1
2 test2
  2.1 test3
    2.1.1 test4 test5 test6
    2.1.2 test7

On the road to retirement? Check out MSN Life Events for advice on how to get there!

Current Thread