Subject: [xsl] Copying Java expressions verbatim without character escaping? From: Michael Ody <Michael.Ody@xxxxxxxxxxxx> Date: Wed, 20 Jun 2001 10:53:09 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: RE: URL for "Things XSLT , Dimitre Novatchev | Thread | Re: [xsl] Copying Java expressions , Jeni Tennison |
RE: [xsl] Container HTML around rec, Chris Bayes | Date | [xsl] Three questions on sorting.., Tim |
Month |