|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Copying Java expressions verbatim without character es
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...
The XML document contains things like
<if>
<expr><![CDATA[a==1 && b==2 || c<3]]></expr>
...
</if>
I want this to become (omitting the <% and %> tags)
if (a==1 && b==2 || c<3) {
...
}
Here's the XSLT I've got at the moment:
<xsl:template match="if">
<xsl:text/> if ( <xsl:value-of disable-output-escaping="yes"
select="expr"/> ) { <xsl:text/>
...
</xsl:template>
Notwithstanding the d-o-e attribute, the output of this is
if (a==1 && b==2 || c<3) {
which obviously is not valid Java!
[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.]
So my question is how to prevent special characters being escaped during the
copy from XML to JSP?
Mike.
---
Signal Computing Ltd. 20 Nugent Road, The Surrey Research Park,
http://www.signal.co.uk Guildford, Surrey GU2 7DF, UK
Tel: +44(0)1483 579900 Fax: +44(0)1483 562836
Registered in London, No. 1672944
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








