XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Nick BondSubject: Finding an alternative to disable-output-escaping
Author: Nick Bond
Date: 15 Nov 2006 11:29 AM
Can anyone help me with this XSLT problem? I'm a novice so the solution may be obvious to you but I've been stuck on it for 2 days! It involves finding an alternative to using disable-output-escaping = "yes", as this method has stopped working since I switched my web hosting service. My old web host used PHP4 with Sabletron 1.0 and my new service uses PHP5 with libxslt Version 1.1.15

I'm building a simple CMS for a web site and am storing all the content in XML files. In particular I have a node value which contains HTML so it's stored as CDATA. Here's an example snippet of my XML...

<content>
<article><![CDATA[<p>Hello world</p>]]></article>
</content>

I'm transforming this XML via PHP with an XSLT stylesheet that contains, amongst other things, the following...

<div><xsl:value-of disable-output-escaping="yes" select="/content/article"/></div>

Using my old set-up (Sabletron) the HTML output was unescaped and came out the way I wanted i.e.

<div><p>Hello world</p></div>

But with the new set-up the resulting HTML is...

<div>&lt;p&gt;Hello world&lt;/p&gt;</div>

... obviously not what i want.

I've searched the web looking for alternatives to disable-output-escaping but can only find advice about not using it - no suggested alternatives. Is there a better way of getting that HTML from the XML node and outputting it 'as is' in the transformation??

Help gratefully received

Nick

Postnext
James DurningSubject: Finding an alternative to disable-output-escaping
Author: James Durning
Date: 15 Nov 2006 01:32 PM
Can you use copy-of instead? Eg:
<div><xsl:copy-of select="/content/article"/></div>

Posttop
Nick BondSubject: Finding an alternative to disable-output-escaping
Author: Nick Bond
Date: 15 Nov 2006 04:24 PM
Thanks James,

I just tried taking the html out of CData and then using xsl:copy-of and it worked! I'd hoped it would be that simple. I told you I was a novice didnt I? :)

Now i just have to validate the HTML when it goes into the XML and it's all good.

Thanks again
Nick

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.