Re: [xsl] Copying Java expressions verbatim without character escaping?

Subject: Re: [xsl] Copying Java expressions verbatim without character escaping?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 20 Jun 2001 18:59:27 +0100
Hi Mike,

> I'm using XSLT to create .jsp files which are mostly HTML but with a
> little JSP code dotted about in them. I want to copy a logical
> expression verbatim from my source XML to my output JSP, but I'm
> having problems if the expression contains ampersands, less-than or
> greater-than symbols. Here's an example...
[snip]
> [Notes: The stylesheet has an output method of 'html'. I'm using
> Xalan to perform the transformation. The JSP file is being created
> by means of the <xalan:write> element.]

Your use of disable-output-escaping should work, and I thought that
Xalan supported it now (have you got the latest version?). The only
place that disabling output escaping doesn't (and shouldn't) work is
if you try it within an attribute value - you cannot create an HTML
page with JSP tags (or code) within attribute values without it being
escaped.

What I'd suggest is that you change your output method to 'text'
rather than 'html'. Then you don't have to worry about escaping any of
the characters in the JSP. Of course, instead you have to worry about
serialising the HTML that you want to include within the page, but
hopefully that shouldn't be too bad - you can just wrap CDATA sections
around the relevant HTML tags in the stylesheet, and imagine that
you're creating HTML as a string rather than generating HTML elements.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread