Dave,

ok. This is what will work.

Use a jsp or a servlet to emit an xml document. The content/type must fit
the type of document. So if its an xml document (which xsl documents are),
the type should be text/xml.

A url to the servlet or the jsp will produce a document which is an xsl
document. So if whatever needs an xsl document, you refer to the document
with the url, and Orion will magically emit the xsl document as you wanted.

We use this technique with svg documents all the timme. There is an example
of this in the javasoft site for xml and jsp.

As far as I know, you can't put the jsp tag language directly in a xsl file.
(That would be jsl ;)= ).

Regards,

The elephantwalker








-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Dave Ford
Sent: Thursday, April 19, 2001 2:24 PM
To: Orion-Interest
Subject: Re: JSP Tags in an XSL Template?


Thanks for your reply Joe and Kesavk.

Wheb I tried to put JSP inside of an xsl in Orion (even after changing
extention to .jsp) I get the following error:

Source XML Error: Use "<" for "<" in attribute values.

Any suggestions?

Dave Ford
Smart Soft - The Java Training Company
http://www.smart-soft.com


----- Original Message -----
From: "Joe Latty" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 9:26 PM
Subject: RE: JSP Tags in an XSL Template?


> You can use the jsp tags. If change the extension from *.xsl to *.jsp and
> then use the jsp as you would an xsl e.g.
>
> <%@ page language="java"
> import="com.stuff.yourStuff,
> com.stuff.yourSchema"
> errorPage="error.jsp" %>
>
> <xsl:stylesheet  xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> <xsl:template match="/">
> <xsl:for-each select="<%=yourSchema.someElementTag%>">
> <table width="100%">
> <tr>
> <td>
> <input id="whatever"  type="text" value="<%=yourStuff.someValue%>">
> <xsl:if test="@<%= yourSchema.someAttributeTag %>[.!='']">
> <xsl:attribute name="readonly">true</xsl:attribute>
> </xsl:if>
> </input>
> </td>
> </tr>
> </table>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> We have done this many times.
>
> Joe
>
>  -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]  On Behalf Of Kesav Kumar
> Sent: Thursday, 19 April 2001 5:58 AM
> To: Orion-Interest
> Subject: RE: JSP Tags in an XSL Template?
>
> You can't use the jsp tags inside the xsl stylesheet.  You can pass
> parameters to the XSL.
>
> Declare <xsl:param> at the top of your xsl and while calling the
> transformation you can pass values to the top level params.  If you are
> using apache's xalan here is the way to pass values.
>
> In your xsl
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:param name="linkURL" />
> <xsl:template match="module">
> <link>
> <xsl:attribute name="href">
> <xsl:value-of select="$linkURL"
> disable-output-escaping="yes"/>
> <xsl:attribute name="rel">stylesheet</xsl:attribute>
> </link>
> </xsl:template>
>
> In your java code write the following.  The following code is according to
> the Xalan1.1.  You can see the xalan2 javadoc for the appropriate way of
> transformation.  In xalan2 the setting of the parameters are in
Transformer
> class.
>
> public static void Transform(String xmlSourceURL, String xslURL, String
> outputURL)
>   throws java.io.IOException,
>          java.net.MalformedURLException,
>          org.xml.sax.SAXException
> {
>   // Use XSLTProcessorFactory to instantiate an XSLTProcessor.
>   org.apache.xalan.xslt.XSLTProcessor processor =
>
org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();
>   // Set the stylesheet parameters
>   processor.setStylesheetParam("linkURL", new
> org.apache.xalan.xpath.XString("http://xxxlco.com/skldjf"))
>
>   // Create the 3 objects the XSLTProcessor needs to perform the
> transformation.
>   org.apache.xalan.xslt.XSLTInputSource xmlSource =
>                         new org.apache.xalan.xslt.XSLTInputSource
> ("foo.xml");
>   org.apache.xalan.xslt.XSLTInputSource xslSheet =
>                        new org.apache.xalan.xslt.XSLTInputSource
> ("foo.xsl");
>   org.apache.xalan.xslt.XSLTResultTarget xmlResult =
>                        new org.apache.xalan.xslt.XSLTResultTarget
> ("foo.out");
>
>   // Perform the transformation.
>   processor.process(xmlSource, xslSheet, xmlResult);
> }
>
> Kesav Kumar
> Software Engineer
> Voquette, Inc.
> 650 356 3740
> mailto:[EMAIL PROTECTED]
> http://www.voquette.com
> Voquette...Delivering Sound Information
>
>
> -----Original Message-----
> From: Dave Ford [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 18, 2001 9:47 AM
> To: Orion-Interest
> Subject: JSP Tags in an XSL Template?
>
>
> Is there anyway to embed jsp tags in an xsl template? For example:
>
> <xsl:template match="module">
>   <link>
>    <xsl:attribute name="href">
>    <%= request.getContextPath()%>/StyleSheets/style.css</xsl:attribute>
>    <xsl:attribute name="rel">stylesheet</xsl:attribute>
>   </link>
> </xsl:template>
>
> If not, is there a better way to add "parameters" to xsl template as I'm
> attemting above with the context path?
>
> Thanks,
>
> Dave Ford
> Smart Soft - The Java Training Company
> http://www.smart-soft.com
>
>
>
>



Reply via email to