Don't make a JSP that build the XML, while treat your JSP as a simple 
XML file, then delegate to the XSL file making the JSP.
To be clearer:
Make a JSP that receives the request
then call from it the servlet (or jsp) that invokes 
Transformer.transform() whose source is just such an XML file:

<doc title="foo">
<description>
        I'm a JSP. I'm processing the request.
<description>
<%
        while(request.getParameterNames().hasMoreElements())
        {
%>
<item><scriptlet><%=(String)request.getParameterNames().nextElement()%
></scriptlet></item>
<%
        }
%>
</doc>

Your data.xsl will have to be changed to include
at the head:

             &lt;%@ page contentType="text/xml" %>

and somewhere else:

<xsl:template match="scriptlet">
     <xsl:apply-templates/>
</xsl:template>

> Today, i'm using JSP to perform the view. I also use JSP as controller
.
> Although view and controller are separated, I'm looking for a best way
 to do
> this via XML/XSLT.
> 
> My approach is :
> 
> A request is sent to the web server :
> - Controller (JSP) handles the request
> - Controller (JSP) asks data to the model
> - Model furnishes Datas (XML) to the controller
> - The controller modifies data to perform request actions
> - The controller forwards data modified to the view using XSL / XSLT
> 
> 
> Here is an example, exactly what I want to do, a JSP handles the reque
st,
> performs some actions and sends data rendered by XSL :
> 
> <%@ page contentType="text/xml" %>
> <?xml:stylesheet type="text/xsl" href="myxsl.xsl" version="1.0"
> encoding="ISO-8859-1"?>
> 
> <doc title="foo">
> <description>
>         I'm a JSP. I'm processing the request.
> <description>
> <%
>         while(request.getParameterNames().hasMoreElements())
>         {
> %>
> <item><%=(String)request.getParameterNames().nextElement()%></item>
> <%
>         }
> %>
> </doc>
> 
> But I want to perform the XSL Transformation on the server side to hav
e the
> full control using something like :
> 
>     StreamSource source = new StreamSource
( THE XML response performed by
> the JSP controller );
>     StreamSource stylesheet = new StreamSource
("D:\\Dev\\web\\data.xsl");
>     // Use a Transformer for output
>    TransformerFactory tFactory = TransformerFactory.newInstance();
>    Transformer transformer = tFactory.newTransformer(stylesheet);
>    StreamResult result = new StreamResult
(out); // out : to the client web
> borwser
>    transformer.transform(source, result);
> 
> I don't know how to forward the XML response of my JSP to the servlet 
doing
> the XSL Transformation. Have an idea ?
> I have never seen example using JSP / XML / XSLT that way. Am I going 
in a
> wrong way ?
> It sounds like to me because the view is completly separated from the 
rest
> of the application.
> 
> fv
> 
> 
> 
> 
> 
> -------------------------------------------------------------
> This Message and any attachments are confidential and intended
> solely for the addressees. And unauthorised use or dissemination
> are prohibited. Emails are suceptible to alteration. Therefore
> neither SWAPCOM nor any of its subsidiaries or affiliates shall
> be liable for the message if altered, changed or falsified.
> 
> ______________________________________________________________________
_____
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
 body
> of the message "signoff SERVLET-INTEREST".
> 
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-
resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> 
> 
>N�����r��zǧu隊[h�+-��ڲ�ܢf�v)ܖ�^�{ay�ʇ�鞲ƠzȠ���HDU,D�51$���b��!����܆+޲6�j˧r��j�!����ǫ�W��{^��-�٥E�(���m���j���w(��k�ۜ���z��z���׫��kz�.�Ǭ�٥,��HDU�i��i��0�[(~�(����楳��z����i


Reply via email to