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

RE: output of cdata within xsl:value-of select

Subject: RE: output of cdata within xsl:value-of select
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 2 Dec 2002 17:36:57 -0000
xsl value of cdata
The CDATA section is irrelevant. CDATA only changes the meaning of
special characters like "<", and there are no such characters in your
CDATA section.

Your problem is an HTML problem. A newline in an HTML document is not
rendered as a newline. You have to replace the newlines with <br/>, or
output the text in a <pre> element.

For replacing newlines with <br/>, see the FAQ.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Natarajan, Chokkalingam
> Sent: 02 December 2002 16:54
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  output of cdata within xsl:value-of select
> 
> 
> Folks,  I have a question with regards to output of CDATA 
> value within a xsl:value-of select in a XSL file. I have an 
> XML data coming to an XSL file as a data stream and the XSL 
> contains the format in which the XSL should be displayed.
> 
> The fragment of code in my XML file is:
> 
> <TGMSG><![CDATA[This is a test message, hopefully this will go through
> 	line2
> 	line3
> 	line4
> 	line5
> 	line6 end.]]>
> </TGMSG>
> 
> There are line breaks (carriage returns) within the CDATA 
> section. This will pass through without any hassle while XML parsing.
> 
> The fragment of code in my XSL file is: 
> 
> Your Message is: <br/>
> <xsl:value-of select="TGMSG"/><br/>
> 
> But when I pass the above XML data input to the XSL file, the 
> output comes in without the line breaks. Like this:
> 
> This is a test message, hopefully this will go through line2 
> line3 line4 line5 line6 end.
> 
> But I want the output to come out like this (in other words, 
> I want to preserve the carriage returns / line breaks that I 
> get within the CDATA, and print them out using my XSL file):
> 
> This is a test message, hopefully this will go through 
> line2 
> line3 
> line4 
> line5 
> line6 end.
> 
> What should I do to achieve this? I need to perform this only 
> by modifying the XSL file. If anyone has encountered this 
> before or know the solution, please let me know. Thanks in advance.
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.