I'm not sure I still have the code in my archives, I will look, but I actually had 
cause to tackle a problem just like this.

We had an application written by a consultant that is now long gone.  He did it in MS 
technologies, using XSLT to transform XML to HTML to generate the output to the 
browser.  Basically, some business logic classes execute, generate XML, then an 
appropriate XSLT is applied to the XML to generate an HTML response.

Well, we're now an all-Java shop (except where we're not :) ), and so this app had to 
get converted.  Converting the back-end logic proved to be a relatively simple matter 
(although the architecture is poor Strus - lots of logic in the Actions, but hey, it 
was quick and easy).  I just had each Action stick the resultant XML in an associated 
ActionForm, and also put in the appropriate XSLT (read from a database) in the form as 
well.

The presentation layer I didn't want to have to re-write, so what I wound up doing was 
finding a class that accepts an XML and XSLT string and returns a string of the XML 
transformed with the XSLT (I don't recall which unfortunately) and I wound up 
generating the HTML *in a JSP*.  In other words, the JSP was pretty much just this:

<html><head><title></title></head><body>
<%=MyXMLTransformer.transform(myForm.getXML(), myForm.getXSLT())%>
</body></html>

All of the actions forward to this JSP, and that's that.

If you are interested I can try and find some code for you, but I thought just 
explaining the basic approach might be helpful in and of itself.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, October 19, 2004 2:31 pm, Mark Lowe said:
>> Now we need to get rid of xsl code and
>> replace it with jsp/struts.
> 
> Why do you need to do this?
> 
> I'd look for a way of getting the xsl transformations to happen via
> struts and then add any new bits using struts jsps. If there are any
> problems with the xsl and nobody knows how to fix it then, perhaps
> replace with JSP. Its hard without knowing the details, but would seem
> wrong..
> 
> Mark
> 
> On 19 Oct 2004, at 20:22, Vicky wrote:
> 
>> Hello all,
>>
>> In my current project we are using xsl which renders
>> xml into xhtml. Now we need to get rid of xsl code and
>> replace it with jsp/struts. Is there an easy tool/way
>> to migrate xsl files into jsps? This is quite huge
>> project so it won't be possible to start it from
>> scratch. Any pointes or help would be appreciated.
>>
>> Thanks,
>>
>>
>>
>>
>>
>> _______________________________
>> Do you Yahoo!?
>> Declare Yourself - Register online to vote today!
>> http://vote.yahoo.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to