[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: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Nov 2001 14:52:07 GMT
disable output escaping nbsp
] 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">&amp;nbsp;&amp;nbsp;</xsl:text></xsl:when>
]       <xsl:when test="$level=2"><xsl:text
] disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:
] text></xsl:when>
]       <xsl:when test="$level=3"><xsl:text
] disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;n
] bsp;&amp;nbsp;</xsl:text></xsl:when>
]       <xsl:when test="$level=4"><xsl:text
] disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;n
] bsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text></xsl:when>
]       <xsl:when test="$level=5"><xsl:text
] disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;n
] bsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text></xsl:when>
]       <xsl:otherwise><xsl:text
] disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;n
] bsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;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">&amp;nbsp;
is not the recommended way of getting a non breaking space.
just <xsl:text>&#160;</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">&#160;</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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.