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

Re: indented lists

Subject: Re: indented lists
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2001 13:57:12 +0100
xslt multilevel numbering
Hi Joerg,

> It should be a indented list. The PDF-file I want to generate should
> look like this:
>
> 1. Listelement 1
> 2. Listelement 2
> 2.1. Listelement 3
> 2.1.1. Listelement 4
> 2.1.2. Listelement 5
> 2.2. Listelement 6
>
> ...and so on.
>
> Am I right, that I have to put the structure in the XML-file?

I'm not very up on XSL-FO, but I *think* that it doesn't do any number
generation for you, so if that's the structure that you're talking
about, you have to do that in XSLT.

In XSLT, the easiest way of achieving multi-level numbering like you
have in the above is to have the structure of the list match the
structure of the numbering:

<list>
   <item>Listelement 1</item>
   <item>Listelement 2
      <list>
         <item>Listelement 3
            <list>
               <item>Listelement 4</item>
               <item>Listelement 5</item>
            </list>
         </item>
         <item>Listelement 6</item>
      </list>
   </item>
</list>

With that structure, you can use xsl:number to create the multi-level
numbering, with something like:

<xsl:template match="item">
   <xsl:number level="multiple" format="1." />
   <xsl:apply-templates />
</xsl:template>

However, just because that's the *easiest* way doesn't mean it's the
*only* way.  You could equally have a flat structure in which each
item referenced its parent, or indicated its level in the list through
an attribute.  With these, numbering is more difficult (because you
can't use xsl:number to do it), but it's not impossible.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 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.