[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How can I obtain a JSP from a XML and XSL?

Subject: RE: How can I obtain a JSP from a XML and XSL?
From: sara.mitchell@xxxxxxxxx
Date: Tue, 12 Nov 2002 14:21:43 -0500
xslt output jsp
I'm not sure I understand what you want to do, 
so let me tell you what I know how to do: output a
JSP page from an XSLT transformation of some XML input. 

If that is what you want -- the output of a transformation
contains JSP directives, including ones that are not valid 
xml, you can do this using disable-output-escaping (d-o-e)
if your XSLT processor supports this feature. If that's
not what you want, skip the rest of this message.

Normally d-o-e is a bad thing to do. But in this case, it's
the only way and this is what d-o-e is meant for. First, 
make sure that the XSLT engine you are using supports 
d-o-e -- check the documentation.  

Then in your XSLT stylesheet, the output should be either html or
xml like this: 

<xsl:output method="xml" ... /> or <xsl:output method="html" ... />

In the template where you need to output the JSP directive
from your message, do something like this: 

<xsl:template match="some node here">
... whatever else you need to do with this node ...
<xsl:text disable-output-escaping="yes"><![CDATA[<%@ taglib
uri="/s2ktaglib.tld" prefix="s2k" %>]]></xsl:text>
...
</xsl:template> 

What is happening here is that the <![CDATA[ ]]> markup is needed to 
get your JSP directive through the XML parser. The JSP is not 
valid XML and the XML parser will expect XML because of the < and > 
characters. So, CDATA just tells the parser not to expect XML inside 
it and the parser is happy. 

The <xsl:text> element outputs text and the disable-output-escaping="yes"
tells the XSLT engine not to escape characters in XML that would normally
have to be escaped like the < and > in the JSP directive.

Hope this helps, 

Sara Mitchell

> -----Original Message-----
> From: Marcial Atienzar Navarro [mailto:maratna@xxxxxxxxxxxxx]
> Sent: Monday, November 11, 2002 11:30 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How can I obtain a JSP from a XML and XSL?
> 
> 
> Hello everybody,
> 
>  I'm using jstl to parse a xml with a xsl. The scheme is the next:
> 
>   parser.jsp
>       |
>       | (with jstl)
>       |
>   parse the xml with the xsl
>       |
>       |
>   I need to obtain a JSP that containt a jsp tag to compile 
> it. How could I
> include the sentence <%@ taglib uri="/s2ktaglib.tld" 
> prefix="s2k" %> to obtain the 
> jsp and the valour of the tag.
> 
>  A lot of thanks,
> 
>    Marcial Atienzar
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.