Numbering and indentation ...

Subject: Numbering and indentation ...
From: Stephane St-Denis <Stephane.St-Denis@xxxxxx>
Date: Wed, 11 Aug 1999 11:00:37 -0400
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


Current Thread