You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Kostas Karadamoglou <ka...@yahoo.gr> on 2005/04/05 21:52:47 UTC

Design Question: JSF and XSLT

I am planning to use JSF with XSL Transformations. What I want to do is 
the following:

I have defined paper exams in xml documents. I want to allow users to 
access paper exams by searching by date, course etc.

When the user selects a specified paper JSF should transform the paper 
(xml) to html utilizing XSLT.

As far I am able transform a xml document and I can hold the html script 
in a string variable.

How can I paste this html script in the response JSF?

Thank you in advance, Kostas

Re: Design Question: JSF and XSLT

Posted by Heath Borders <he...@gmail.com>.
You should be able to use XSLT on the client-side to transform the document 
if you put that document inside an IFRAME. That would be the easiest way to 
do it.
 Otherwise, if you still want to do the transformation on the server, you 
can just insert the HTML via the outputText tag as I said before.
 Good luck!

 On Apr 5, 2005 3:35 PM, Kostas Karadamoglou <ka...@yahoo.gr> 
wrote: 
> 
> I think you have understood my question.
> 
> If I will try to do it with a client side transformation then I have the
> following restrictions:
> 
> The xslt generates a static html page. What I want is something like that:
> 
> I want the response of the JSF to include a header, a left panel and a
> right panel that contain dynamic content (for instance, jsf tags).
> 
> So I want the generated html of the xsl to the center area of the jsf
> response.
> 
> Is it possible to use xslt on the client side and put the generated html
> script in an area of the response html ?
> 
> Heath Borders wrote:
> 
> > I'm not sure I understand your question entirely, so let me see if I
> > can better understand what you're trying to do:
> >
> > First, you have the exams stored in xml files.
> > Then, you want to transform them into html using XSLT.
> >
> > That part is easy to understand. My first criticism is that for
> > advanced browsers IE 5.5+, Mozilla, XSLT can be done on the client, so
> > you really wouldn't need to do any of the transformation on the server.
> >
> > However, if you are dead-set on doing the transformation on the
> > server, then I'm guessing that your question is how do you get the
> > transformed HTML String that the XSLT produced into your JSF document?
> >
> > Just use an <h:outputText /> with a ValueBinding to a property on your
> > request bean that behind the scenes does the XSLT transformation and
> > returns a String. Make sure that you have escape="false" set so that
> > the output is not escaped.
> >
> > If this is _all_ that the page does, JSF might be overkill for you.
> >
> >
> > On Apr 5, 2005 2:52 PM, *Kostas Karadamoglou* <karadamoglou_k@yahoo.gr
> > <ma...@yahoo.gr>> wrote:
> >
> > I am planning to use JSF with XSL Transformations. What I want to
> > do is
> > the following:
> >
> > I have defined paper exams in xml documents. I want to allow users to
> > access paper exams by searching by date, course etc.
> >
> > When the user selects a specified paper JSF should transform the paper
> > (xml) to html utilizing XSLT.
> >
> > As far I am able transform a xml document and I can hold the html
> > script
> > in a string variable.
> >
> > How can I paste this html script in the response JSF?
> >
> > Thank you in advance, Kostas
> >
> >
> >
> >
> > --
> > -Heath Borders-Wing
> > hborders@mail.win.org <ma...@mail.win.org>
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org

Re: Design Question: JSF and XSLT

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
I think you have understood my question.

If I will try to do it with a client side transformation then I have the 
following restrictions:

The xslt generates a static html page. What I want is something like that:

I want the response of the JSF to include a header, a left panel and a 
right panel that contain dynamic content (for instance, jsf tags).

So I want the generated html of the xsl to the center area of the jsf 
response.

Is it possible to use xslt on the client side and put the generated html 
script in an area of the response html ?

Heath Borders wrote:

> I'm not sure I understand your question entirely, so let me see if I 
> can better understand what you're trying to do:
>  
> First, you have the exams stored in xml files.
> Then, you want to transform them into html using XSLT.
>  
> That part is easy to understand.  My first criticism is that for 
> advanced browsers IE 5.5+, Mozilla, XSLT can be done on the client, so 
> you really wouldn't need to do any of the transformation on the server.
>  
> However, if you are dead-set on doing the transformation on the 
> server, then I'm guessing that your question is how do you get the 
> transformed HTML String that the XSLT produced into your JSF document?
>  
> Just use an <h:outputText /> with a ValueBinding to a property on your 
> request bean that behind the scenes does the XSLT transformation and 
> returns a String.  Make sure that you have escape="false" set so that 
> the output is not escaped.
>  
> If this is _all_ that the page does, JSF might be overkill for you.
>
>  
> On Apr 5, 2005 2:52 PM, *Kostas Karadamoglou* <karadamoglou_k@yahoo.gr 
> <ma...@yahoo.gr>> wrote:
>
>     I am planning to use JSF with XSL Transformations. What I want to
>     do is
>     the following:
>
>     I have defined paper exams in xml documents. I want to allow users to
>     access paper exams by searching by date, course etc.
>
>     When the user selects a specified paper JSF should transform the paper
>     (xml) to html utilizing XSLT.
>
>     As far I am able transform a xml document and I can hold the html
>     script
>     in a string variable.
>
>     How can I paste this html script in the response JSF?
>
>     Thank you in advance, Kostas
>
>
>
>
> -- 
> -Heath Borders-Wing
> hborders@mail.win.org <ma...@mail.win.org> 



Re: Design Question: JSF and XSLT

Posted by Heath Borders <he...@gmail.com>.
I'm not sure I understand your question entirely, so let me see if I can 
better understand what you're trying to do:
 First, you have the exams stored in xml files.
Then, you want to transform them into html using XSLT.
 That part is easy to understand. My first criticism is that for advanced 
browsers IE 5.5+, Mozilla, XSLT can be done on the client, so you really 
wouldn't need to do any of the transformation on the server.
 However, if you are dead-set on doing the transformation on the server, 
then I'm guessing that your question is how do you get the transformed HTML 
String that the XSLT produced into your JSF document?
 Just use an <h:outputText /> with a ValueBinding to a property on your 
request bean that behind the scenes does the XSLT transformation and returns 
a String. Make sure that you have escape="false" set so that the output is 
not escaped.
 If this is _all_ that the page does, JSF might be overkill for you.

 On Apr 5, 2005 2:52 PM, Kostas Karadamoglou <ka...@yahoo.gr> 
wrote: 
> 
> I am planning to use JSF with XSL Transformations. What I want to do is
> the following:
> 
> I have defined paper exams in xml documents. I want to allow users to
> access paper exams by searching by date, course etc.
> 
> When the user selects a specified paper JSF should transform the paper
> (xml) to html utilizing XSLT.
> 
> As far I am able transform a xml document and I can hold the html script
> in a string variable.
> 
> How can I paste this html script in the response JSF?
> 
> Thank you in advance, Kostas
> 



-- 
-Heath Borders-Wing
hborders@mail.win.org