Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old July 30th, 2003, 10:21 AM
Authorized User
 
Join Date: Jul 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default CDATA in XML - convert to HTML

Hi all

Have a problem. I have a XML file which has a tag <Document> </Document>, that holds a CDATA. This CDATA holds the information in a particular format. When I transform this xml file to html using a xsl file, I need to display in the same format as it is XML.

How is this possible?

thanks in-advance
suri

 
Old July 31st, 2003, 08:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 147
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to armmarti
Default

Hi,

Quote:
quote:Originally posted by suri
Have a problem.  I have a XML file which has a tag <Document> </Document>, that holds a CDATA.  This CDATA holds the information in a particular format. When I transform this xml file to html using a xsl file, I need to display in the same format as it is XML.
It will be nice to see the content of the element "Document". If the content is a well-balanced XML snippet(that is, after adding a parent element to the content, the resulting stuff becomes a well-formed XML document), then it's strange that you wrapped the content into CDATA section. In this case you can simply remove the CDATA section delimiters and use xsl:copy-of to deep-copy the content. If you have no control over the source XML(e.g., it's dynamically generated), or the content of the element contains also DTD stuff, Saxon 7.6.5 offers saxon:parse(string) extension function, which parses the argument, and returns document node if the argument represents well-formed XML; otherwise it reports an error. You can get the root node returned by this function and then use xsl:copy-of instruction to deep-copy the content.

Hope this will help.

Regards,
Armen





Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript in CDATA doesnt escape html eruditionist XSLT 5 September 17th, 2008 01:07 PM
SQL Server 2005 XML: FOR XML PATH -> cdata? stoves SQL Server 2005 1 July 8th, 2008 02:40 AM
Render HTML inside CDATA with XSL c2c XSLT 0 September 10th, 2006 11:10 AM
Extract the XML file from CDATA haixia XSLT 2 August 3rd, 2006 02:01 PM
CDATA Set with For XML Explicit Yehuda SQL Server 2000 0 August 13th, 2003 01:50 PM





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