Re: [xml] output of cdata within xsl:value-of select



On Mon, Dec 02, 2002 at 10:13:57AM -0600, Natarajan, Chokkalingam wrote:
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

  wrong list use xslt gnome org

as a data stream and the XSL contains the format in which the XSL should be
displayed.

  displayed, NOOO *emitted* is the right verb !!!!

But when I pass the above XML data input to the XSL file, the output comes
in without the line breaks. Like this:

  how did you look at the data ????

paphio:~/tmp -> cat tst.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

<xsl:template match="/">
<doc>
<xsl:value-of select="TGMSG"/>
</doc>
</xsl:template>
</xsl:stylesheet>

paphio:~/tmp -> cat tst.xml
<TGMSG><![CDATA[This is a test message, hopefully this will go through
      line2
      line3
      line4
      line5
      line6 end.]]>
</TGMSG>
paphio:~/tmp -> xsltproc tst.xsl tst.xml
<?xml version="1.0"?>
<doc>This is a test message, hopefully this will go through
      line2
      line3
      line4
      line5
      line6 end.
</doc>
paphio:~/tmp ->

  libxslt does the Right Thing

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):

  they are preserved, your HTML renderer merged them, use <pre>.
Look at the output next time before suggesting the software may have a problem.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]