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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Sum Groups into a subtotal an... (4)
-> - Finding an alternative to disa... (3)
-> ->Finding an alternative to...
-> ->Finding an alternative to...
-> + Counting unique values of an a... (3)
-> + XSLT not acceptable (2)
-> + Use of XSL file (8)
-> + Mapping Question. Please Help (2)
-> + XSL - FO Page count (3)
-> + xml tree to flat xml (3)
-> + xsl:element - qname (3)
-> + XSLT and multiple children (2)
-> + To find totalamount (5)
-> - Comparing Strings - Using cont... (1)
-> + AUtomatic conversion XML to XM... (2)
-> + recursion of wurfl document - ... (4)
-> + Traversing XML Tree - Want to ... (4)
-> + Instead of repeating code, can... (3)
-> + XSL - Display Variable From UR... (4)
-> + Show/Hide SPAN tag (2)
-> + Help a newbie (5)
-> + convert attribute to element (2)
-> + Learning XML/XSLT (2)
-- Previous [1261-1280] [1281-1300] [1301-1320] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.