[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: TOC indents in XHTML?
] 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? :-) it would probably be better not to use non breaking space and just indent with nested lists and css styling, but if you want to use nbsp looking at the faq or archives for this list will show that ] <xsl:text disable-output-escaping="yes">&nbsp; is not the recommended way of getting a non breaking space. just <xsl:text> </xsl:text> is all you need. you just want one of those for each ancestor part element, so that's <xsl:template name="toc-indent"> <xsl:for-each select="ancestor::part"> </xsl:for-each> </xsl:template> David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. 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
|