This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: indented lists


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]