Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 5th, 2006, 03:08 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default about carriage return...

Hello.
I'm converting an XML into HTML. I have this element in XML:
___________________________________
<glossary>
RVA Recorded Voice Announcement
TCP Transport Control Protocol
QOS Quality Of Service
</description>
___________________________________

Then, when I naively try to to put it in my resulting HTML...

<xsl:value-of select="./glossary"/>

I get this ugly result:

____________________________________
Glossary:
RVA Recorded Voice Announcement TCP Transport Control Protocol QOS Quality Of Service
____________________________________
Carriage returns and some spaces have disappeared.

I'm not sure if the problem is in the XML, or the XSL transformation. Do I have to include something in the XML for not losing the carriage return? Or maybe in the XSL?

Sorry if this has been asked before, I couldn't find out by myself...

Thanks
  #2 (permalink)  
Old July 5th, 2006, 04:11 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The problem isn't with XML or with your XSLT, it is with HTML. In HTML, multiple whitespace characters are considered equivalent to a single space and are displayed as such by the browser. The simplest way out of this is to wrap the output in a <pre> element.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking for a Carriage return darkhalf Classic ASP Databases 2 November 5th, 2007 06:15 AM
insert carriage return darkhalf Javascript 0 April 10th, 2007 02:42 PM
Carriage Return and Enter keys flashster BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 13th, 2006 06:38 AM
New Line/Carriage Return interrupt Javascript How-To 7 October 3rd, 2004 06:27 AM
HELP Inserting Carriage Return orangem Classic ASP Databases 8 July 5th, 2004 08:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.