[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to preserve whitespace in the stylesheet?

Subject: RE: How to preserve whitespace in the stylesheet?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 20 Dec 2000 12:55:56 -0000
preserve whitespace xslt
> From: Robert Nicholson [mailto:robert@xxxxxxxxxxxx]
> 
> I have the following template rule
> 
> <xsl:template name="separated-list">
> 	<xsl:param name="nodes"/>
> 	<xsl:param name="separator"/>
> 	<xsl:for-each select="$nodes">
> 		<xsl:value-of select="."/>
> 		<xsl:if test="position() != last()">
> 			<xsl:value-of select="$separator"/>
> 		</xsl:if>
> 	</xsl:for-each>
> </xsl:template>
> 
> Sometimes separator is "," and other times it's a <BR>

If the separator is a node-set containing a single <BR/> element, then
<xsl:value-of> will output nothing (the string value of an empty element).
Try using <xsl:copy-of> instead.

> also, where is it documented exactly why you cannot do
> 
> <xsl:text><BR/><xsl:text>?
> 
The fact that the <xsl:text> element can contain only #PCDATA is documented
in XSLT Appendix B. The reasons why are not documented (they never are!),
but given that the purpose of xsl:text is to output text nodes, it wouldn't
make very much sense to have anything else in there.

Mike Kay

 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.