Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

XML with CDATA and displaying with XSL

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
We have CDATA in a tag in xml. How can we display it correctly using XSL.
the tag looks like
<temp>
<![CDATA[
<strong>hello ALL</strong>
]]>
</temp>
the display output type is html and it should display 'hello ALL' in BOLD. does diplaying this depends on the encoding.
thanks a ton!
gowri
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think its not possible(atleast to me)..
you can get the value CDATA by <xsl:value-of select="/temp" /> this will give you <strong>hello</strong>but not the hello alone..
for your case you can try something like
<pre>
<xsl:value-of select="temp"/>
</pre>
also make sure that you have <xsl:output method="html"/> declared at the top of your xsl.
This will make sure that html output looks like <strong>hello</strong>
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the soluce is :
<temp>
<![CDATA[<strong>hello ALL</strong>]]>
</temp>
<xsl:value-of disable-output-escaping="yes" select="temp"/>
I've tried this and it was okay.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"XMoon Ray",
May I ask you to take a look at our naming policy and adjust your display name accordingly.
Thanks.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic