struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject RE: Model 2 with a half-order of X
Date Wed, 12 Mar 2003 15:17:08 GMT
If you're able to use JSTL, it makes it pretty easy to leverage a JSP for both
the creation of the XML document and the application of a transformation:

<x:transform xslt="${style}">
  <!-- body specifies XML document and transform params -->
</x:transform>

You can also capture the result of the transformation as an org.w3c.dom.Document:

<x:transform xslt="${style}" var="xformDoc" scope="request">
  <!-- body specifies XML document and transform params -->
</x:transform>

or a javax.xml.transform.Result:

<x:transform xslt="${style}" result="${xformResult}">
  <!-- body specifies XML document and transform params -->
</x:transform>

Quoting James CE Johnson <jcej@tragus.org>:

> > Jeff,
> >
> > I haven't tried this before, but it seems like one solution would be to
> > generate your XML doc in the Action (or some delegate) and place it in
> > the appropriate scope and then use XTags
> > (http://jakarta.apache.org/taglibs/doc/xtags-doc/intro.html) to
> > transform the doc.
> >
> > Another solution, would be to generate the XML doc and transform it in
> > the Action (or delegate) and then write directly to the response output
> > stream and return a null ActionForward which will tell Struts that the
> > response has been handled. Ofcourse, you will have to render the entire
> > page (header, body, footer).
> 
> You can aleviate that by using tiles. Create a layout that does your
> header/body/footer inclusions. Then your 'body 'provider can do the XML
> transformation as you describe.
> 
> >
> > You may also want to look into Cocoon. I believe its just servlet,
> > instead of
> > an entire framework, which can be used to transform XML docs.
> >
> > HTH,
> >
> > robert
> >
> >> -----Original Message-----
> >> From: Jeff Smith [mailto:jeffs@centralscheduling.net]
> >> Sent: Tuesday, March 11, 2003 4:51 PM
> >> To: Struts Users Mailing List
> >> Subject: Model 2 with a half-order of X
> >>
> >>
> >> I've got a situation where a lot of the content in my app is going to
> >> be based on structured documents that are pulled from my database.
> >>
> >> I'd like to be able to create an XML representation of this doc
> >> (at display
> >> time) and then apply a user-selected XSLT to transform the doc
> >> into a couple
> >> of different structures (perhaps a summary view, a detailed view and a
> >> change-log view) before finally applying some style sheets (CSS or
> >> XSL) to display it.
> >>
> >> I've looked at Model2X and StrutsCX, but they're way overkill for my
> >> needs.
> >> I'm quite happy with struts/JSP for my site layout and navigation. I
> >> don't want to re-write my entire site just to transform a few document
> >> pages.
> >>
> >> Does anybody have any suggestions for how to do XML generation and
> >> XSLT transformation from within an Action method?
> >>
> >> I imagine doing this with a two-step action. Step one is a
> >> docPreparation step that creates the XML and does the content
> >> transformation. Step 2 (chained from step 1) would then render the doc
> >> to the tile that I'm using for doc presentation.
> >>
> >> Any pointers would be appreciated.
> >>
> >> Jefficus
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
> >> additional commands, e-mail: struts-user-help@jakarta.apache.org
> >>
> >>
> >
> >
> > --------------------------------------------------------------------- To
> > unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
> > additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message