Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML 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 January 9th, 2007, 01:25 PM
Registered User
 
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default question on CDATA

Hi there,
  I am trying to wrap all data that has special characters in it with <![CDATA[ ]]> section in an xsl. for example, <bookname><![CDATA[Rainbow & it's Story]]></bookname>...

The problem is that i am retriving the book name using
<xsl:value-of select="BookName"/>....so i wanted to know if the following syntax is correct...

<bookname><![CDATA[ ]]><xsl:value-of select="BOOKNAME"/><![CDATA[ ]]></bookname>

Any corrections or changes needed, please let me know....

thanks...
rahul


 
Old January 9th, 2007, 03:53 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your syntax is "correct" but it won't have any effect. CDATA sections don't have any representation in the tree data model (they aren't nodes), so the only way you can create them is at serialization time. Try <xsl:output cdata-section-elements="bookname"/>. It isn't possible to be any more selective than that.

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
Nested Cdata Coolcampers XML 7 August 1st, 2008 03:07 PM
usage of cdata vsempoux XSLT 1 July 11th, 2008 08:38 AM
Add a CDATA section; add nodeset to CDATA section kssudhish XSLT 3 January 3rd, 2008 07:13 AM
CDATA haixia XSLT 0 August 7th, 2006 03:03 PM
CDATA issue sgruhier XSLT 0 February 20th, 2005 03:28 AM





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