[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Numbering and indentation ...

Subject: RE: Numbering and indentation ...
From: Bernhard Keil <Bernhard.Keil@xxxxxx>
Date: Wed, 11 Aug 1999 17:54:07 +0200
fundamental of numbering
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.