RE: Numbering and indentation ...

Subject: RE: Numbering and indentation ...
From: Bernhard Keil <Bernhard.Keil@xxxxxx>
Date: Wed, 11 Aug 1999 17:54:07 +0200
i would not make the numbering
a part of the xml-document (imagine if you want to insert
a new fundamental and want a renumbering),
but let the XSL calculate the numbers

-----Original Message-----
From: Stephane St-Denis [mailto:Stephane.St-Denis@xxxxxx]
Sent: Wednesday, August 11, 1999 5:01 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Numbering and indentation ...


Hi everybody.  I would like to have your suggestion about this treatment
for
a structure.

My document XML is :
<fund>
 <fundamentals>
  <fundamental>
   <name>Fundamental 1</name>
   <fundamental>
    <name>Fundamental 11</name>
   </fundamental>
  </fundamental>
  <fundamental>
   <name>Fundamental 2</name>
   <fundamental>
    <name>Fundamental 21</name>
    <fundamental>
     <name>Fundamental 211</name>
    </fundamental>
   </fundamental>
  </fundamental>
 </fundamentals>
<fund>

My treatment is :

<xsl:template match="fund">
<xsl:for-each select="//name">
 <xsl:if test="count(from-ancestors-or-self(*))=3">
  <div style="margin-left:1em">
   <xsl:number level="single" count="fundamental" format="1.1 "/>
   -- Display name --
  </div>
 </xsl:if>
 <xsl:if test="count(from-ancestors-or-self(*))=4">
  <div style="margin-left:2em">
   <xsl:number level="single" count="fund/fundamentals/fundamental"
format="1.1 "/>
   <xsl:text>.</xsl:text>
   <xsl:number level="single" count="fundamental" format="1.1 "/>
   -- Display name --
  </div>
 </xsl:if>
 <xsl:if test="count(from-ancestors-or-self(*))=5">
  <div style="margin-left:3em">
   <xsl:number level="single" count="fund/fundamentals/fundamental"
format="1.1 "/>
   <xsl:text>.</xsl:text>
   <xsl:number level="single"
count="fund/fundamentals/fundamental/fundamental" format="1.1 "/>
   <xsl:text>.</xsl:text>
   <xsl:number level="single" count="fundamental" format="1.1 "/>
   -- Display name --
  </div>
 </xsl:if>
 </xsl:for-each>
</xsl:template>

Resultat :
 1. Fundamental 1
  1.1 Fundamental 11
 2. Fundamental 2
  2.1 Fundamental 21
  2.1.1 Fundamental 211

( Note : I used LotusXSL_0_17_2  to build html page.)

Is there a way simpler to obtain the same result?



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread