[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Translating the contents of a XML field as HTML...

Subject: Re: Translating the contents of a XML field as HTML...
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 10 Jan 2003 11:50:32 GMT
phil carty
This is a FAQ.

Basically you have an input that looks like

<xxx><![CDTDA[<b>example text</b>]]></xxx>

or, equivalently


<xxx>&lt;b>example text&lt;/b></xxx>


XSLT is not really designed to cope well with such input.
The usual advice, if you can control your input format, is do not start
from there, it's much better if you can have input that looks like

<xxx><b>example text</b></xxx>

In which case you simply need
<xsl:copy-of select="xxx/node()"/>



If you can't change your input form you have three choices,

* try to use the string handling features of XSLT to recognise
the markup and create the necessary elements, doable in simple cases,
but not much fun.

* See if your XSLT system has an extension function that would allow you
to pass the string to an XML parser (or an html parser that returns sax
events)

* or use

<xsl:value-of disable-output-encoding="yes" select="xxx/node()"/>

which will sort of seem to work if your XSLT processor supports d-o-e.
Using d-o-e is evil (search the archives of this list for 1001 reasons
why:-) but in cases where the input language is badly (or unhelpfully)
designed, it sometimes comes to the rescue.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.