This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: indented lists
- To: "Joerg Schmitz" <schmitz_joerg at web dot de>
- Subject: Re: [xsl] indented lists
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 5 Apr 2001 13:57:12 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <200104041501.f34F1YN22901@mailgate3.cinetic.de>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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