|
Subject: RE: [xsl] TOC despair From: "John Meyer" <jmeyer@xxxxxxxxxxx> Date: Wed, 3 Dec 2003 20:04:28 -0500 |
I had to go back and look at how I did this result in a previous
project. The best way to do this is put a newline before each chapter
except the first. This is much easier to understand too as more closely
states your intention.
<xsl:template match="chapter" mode="toc">
<xsl:if test="position() != 1">
<xsl:attribute name="margin-top">1em</xsl:attribute>
</xsl:if>
</xsl:template>
John Meyer
Senior Software Engineer
Clinician Support Technology
1 Wells Avenue, Suite 201
Newton, MA 02459
www.cstlink.com
-----Original Message-----
From: Gustaf Liljegren [mailto:gustaf.liljegren@xxxxxxxxxxxx]
Sent: Wednesday, December 03, 2003 6:43 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] TOC despair
This shouldn't be hard, but I can't get it right. I'll try to give
enough
info. The XML structure looks something like this:
<book>
<chapter>
<section>
<section/>
</section>
</chapter>
</book>
One section may contain other sections an so on. The problem is in the
TOC
generation, where I want a little space after each chapter, like so:
Chapter 1: Elephants....................2 <-- chapter
African Elephants.......................2 <-- chapter/section
Serengeti.............................3 <-- chapter/section/section
Indian Elephants........................4 <-- chapter/section
<-- space here, please
Chapter 2: Tigers.......................5
How do I say in XPath "the last section in this chapter"? Here's my try,
that won't work:
<xsl:template match="section" mode="toc">
...
<xsl:if test="count(following::section) = 0">
<xsl:attribute name="margin-bottom">1em</xsl:attribute>
</xsl:if>
...
</xsl:template>
Thanks,
Gustaf
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] TOC despair, John Meyer | Thread | [xsl] Combining two nodesets, Adam van den Hoven |
| RE: [xsl] TOC despair, John Meyer | Date | [xsl] Combining two nodesets, Adam van den Hoven |
| Month |