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 June 5th, 2008, 09:05 PM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default missing CDATA in the output

i used CDATA in my xsl in the following way:
      <request>
        <xsl:value-of disable-output-escaping="yes" select="string('&lt;![CDATA[')"/> <xsl:copy-of select="$request"/> <xsl:value-of disable-output-escaping="yes" select="string(']]&gt;')"/>
      </request>

in the transformed output i am not able to see the CDATA in the output

<request>
  <a>123</a>
</request>

instead of

<![CDATA[<request><a>123</a></request>]]>

why is it so?


 
Old June 6th, 2008, 02:27 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Firstly, disable-output-escaping doesn't always work: processors aren't obliged to support it, and most processors will ignore it if you aren't serializing the output of the transformation. So we need to know more about the environment in which you are running.

However, if d-o-e isn't working, that wouldn't explain your output.

I'm afraid as so often happens, the conclusion is that the problem lies in the part of the application that you haven't shown us.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 6th, 2008, 06:54 AM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default

The XSL processor that we are using is a customized one. The evironment that i am working in is a SOA appliance - XI50. Is this information sufficient?

i am able to get CDATA in the output if do this way:

<request>
        <xsl:value-of disable-output-escaping="yes"
select="string('&lt;![CDATA[')"/>
        <xsl:value-of disable-output-escaping="yes"
select="string('&lt;![CDATA[')"/>
        <xsl:copy-of select="$request"/>
        <xsl:value-of disable-output-escaping="yes"
select="string(']]&gt;')"/>
        <xsl:value-of disable-output-escaping="yes"
select="string(']]&gt;')"/>
</request>

(CDATA value-of tags repeated twice)

which i feel is not the correct way. what is the correct solution?

 
Old June 6th, 2008, 07:02 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Very peculiar. I think this problem is product-specific and you need to go to your XSLT vendor for support.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 6th, 2008, 07:04 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

But if your content is XML, you are using copy-of, why do you need a CDATA section anyway?

--

Joe (Microsoft MVP - XML)
 
Old June 6th, 2008, 07:48 AM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default

in the request tag i have a xml and i am sending this to a web service. The web service says request is invalid if i am not sending the [!CDATA ]]>. if my understanding is right, that is the purpose of the CDATA correct, that is to escape '<' '>'.

 
Old June 6th, 2008, 10:15 AM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default

Thanks Kay. i have asked for explanation from the vendor.






Similar Threads
Thread Thread Starter Forum Replies Last Post
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
missing schemalocation in output XML matrixman XSLT 7 May 4th, 2007 07:55 AM
CDATA haixia XSLT 0 August 7th, 2006 03:03 PM
cdata-section-elements in xsl:output ROCXY XSLT 1 March 2nd, 2006 11:44 AM





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