You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Kevin Gutch <kg...@protechemail.com> on 2007/05/15 16:47:25 UTC
Struts JSTL Migration
Hi,
I have an existing application that I am completely migrating to JSF.
Everything seems fine but I am trying to figure out what to do with an
area of the app where I use
<x:transform xml="${xml}" xslt="${xslt}" />. This does not want to seem
to work with JSF. Should it? If not what are my alternatives?
Thanks
Kevin
Re: Struts JSTL Migration
Posted by "::SammyRulez::" <sa...@gmail.com>.
I have solved the same problem moths ago.
I supose you have dom and xslt/dom in the xml and xslt vars.
I developed a managedbean based on dom4j.
Move the code you youe to ooad xml and xslt to that bean and make a
getTransformedData() method like this
public String getTransformedData() {
// load the transformer using JAXP
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(
new StreamSource( stylesheet )
);
// now lets style the given document
DocumentSource source = new DocumentSource( document );
DocumentResult result = new DocumentResult();
transformer.transform( source, result );
// return the transformed document
Document transformedDoc = result.getDocument();
return transformedDoc.asXML();
}
where document and stylesheet are your old xml and xslt.
then replace your tag with a simple
<h:outputText value="#{transformerBean.tansformedData}" ecape="false" />
2007/5/15, Kevin Gutch <kg...@protechemail.com>:
> Hi,
>
> I have an existing application that I am completely migrating to JSF.
> Everything seems fine but I am trying to figure out what to do with an
> area of the app where I use
> <x:transform xml="${xml}" xslt="${xslt}" />. This does not want to seem
> to work with JSF. Should it? If not what are my alternatives?
>
> Thanks
>
> Kevin
>
>
--
::SammyRulez::
http://www.kyub.com/blog/
-----------------------------------------------------------------
La programmazione รจ per un terzo interpretazione e per due terzi ispirazione.
E per un terzo mistificazione