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

RE: Adding HTML Data Into XSL File

Subject: RE: Adding HTML Data Into XSL File
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 3 Jul 2002 15:24:30 +0100
xsl to show unparsed html
> I have been directed to add a <img src="/somepathtoanimage"> 
> to the xsl. But the path needs to be dynamic (coming from a 
> servlet parameter). So I created a <xsl:param name="image" 
> select="'/defaultpath'" /> And when I do the transform, I try 
> and put in a valid generated path, but it does not work. When 
> I source the page,  the browser shows the following:
> 
> </table>&lt;img src="/somepaththat/isvalid/a.gif"&gt;</form>
> 
> So it prints the above to the screen and not <img 
> src="/somepaththat/isvalid/a.gif"> which would show the a.gif.
> 
> Any ideas how to get around this?
> 
You are passing in a string that contains markup. The XSLT processor
doesn't know that you want the "<" and ">" characters treated as markup,
so it escapes them.

There are two solutions.

(a) pass in a parsed XML document (e.g. a DOM) instead of a string.
(b) tell Xalan not to escape the special characters in the string by
using disable-output-escaping.

We usually discourage disable-output-escaping on this list, because it
can be greatly abused, but this is exactly the situation it is useful
for, when you want to include unparsed HTML directly into your
serialized output.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 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.