|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Having Tags when the output method is text
Hi Swati,
> Here is my problem description. I have to generate a jsp file using
> xslt . The problem lies in that jsp contains both html tags plus
> some java specific code enclosed in <% generally. If i use the
> output format as html or xml then everywhere i have to disable
> output escaping because in the output file i want < and not < .
> If i use the output format as text, the html tags have to be
> included in the cdata section or else they donot appear in the
> output. Is there any better way where i can obtain the combination
> the text and html and have minimum number of cdatas or disable
> output escapings?
The better way is to use the XML syntax for JSP so that you don't need
to have <%...%> in the output at all. There's a useful
summary/cheat-sheet on the XML syntax for JSP and how it maps to the
normal syntax at http://java.sun.com/products/jsp/pdf/card12.pdf. Once
you're creating XML, of course, there's no disabling of output
escaping required.
If you can't use that, for some reason, you could minimise the number
of disable-output-escapings by creating named template(s) for doing the
messy work, something like:
<xsl:template name="jsp:scriptlet">
<xsl:param name="content" />
<xsl:text disable-output-escaping="yes"><%</xsl:text>
<xsl:value-of select="$content" />
<xsl:text disable-output-escaping="yes">%></xsl:text>
</xsl:template>
and then calling that named template to create the JSP code:
<xsl:call-template name="jsp:scriptlet">
<xsl:with-param name="content">
... your code in here ...
</xsl:with-param>
</xsl:call-template>
The good thing about doing it that way is that it will make it easy to
switch to the XML syntax later on, when you're able to.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
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








