Re: [xsl] indented lists

Subject: Re: [xsl] indented lists
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2001 13:57:12 +0100
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:

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

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 />

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.



Jeni Tennison

 XSL-List info and archive:

Current Thread