[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

Subject: Re: Having Tags when the output method is text
From: "Swati Attarde" <swatid18@xxxxxxxxxxx>
Date: Thu, 01 Aug 2002 12:00:46 +0000
attarde
Hi Jeni,
I face a new problem if i use the call template approach you suggested. Whenever i call this template inside any <xsl:attribute> tag, the output escaping doesnt work any more. How could i avoid this?
regards,
swati




----Original Message Follows----
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Reply-To: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
To: "Swati Attarde" <swatid18@xxxxxxxxxxx>
CC: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Having Tags when the output method is text
Date: Thu, 1 Aug 2002 11:43:38 +0100

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 &lt; .
> 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">&lt;%</xsl:text>
  <xsl:value-of select="$content" />
  <xsl:text disable-output-escaping="yes">%&gt;</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/






------------------------------------------------------------ Eat well, stay fit, die anyway ------------------------------------------------------------




_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com


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.