|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: TOC indents in XHTML?
Subject: Re: TOC indents in XHTML?
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 27 Nov 2001 17:12:09 +0100
|
It's much easier:
<xsl:for-each select="ancestor::part">
<xsl:text>  </xsl:text>
</xsl:for-each>
Don't use HTML-entities like , but Unicode  , which is exactly
the same!
Regards,
Joerg
Gustaf Liljegren wrote:
I have made a stylesheet to convert an XML document format to XHTML.
Documents conforming to the DTD is divided into a recursive <part> element.
For each level of depth (nested <part> elements) I want another two spaces
in the TOC, like this:
1 The first chapter
1.1 Some sub-section of the first chapter
1.2 Another sub-section
2 Another chapter
2.1 A sub-section of the second chapter
2.1.1 A sub-sub-section.
2.1.2 Another sub-sub-section.
Currently, I have a template for the indents that looks like this:
<xsl:template name="toc-indent">
<xsl:variable name="level" select="count(ancestor::part)"/>
<xsl:choose>
<xsl:when test="$level=0"><xsl:text
disable-output-escaping="yes"></xsl:text></xsl:when>
<xsl:when test="$level=1"><xsl:text
disable-output-escaping="yes">&nbsp;&nbsp;</xsl:text></xsl:when>
<xsl:when test="$level=2"><xsl:text
disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;</xsl:
text></xsl:when>
<xsl:when test="$level=3"><xsl:text
disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;</xsl:text></xsl:when>
<xsl:when test="$level=4"><xsl:text
disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;</xsl:text></xsl:when>
<xsl:when test="$level=5"><xsl:text
disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text></xsl:when>
<xsl:otherwise><xsl:text
disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text></xsl:other
wise>
</xsl:choose>
</xsl:template>
It works, but it's not smart and far from beautiful. There is a better way
to do it, isn't it? :-)
Gustaf
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
--
System Development
VIRBUS AG
Fon +49(0)341-979-7435
Fax +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|