Re: Struts and XSL ?
Hi Andrew, StrutsCX is Struts with XSLT - as alternative to JSP. StrutsCX overcomes the limitations of the Struts Framework by enabling you to utilize XML, XSLT, and XPath technologies instead of its standard JavaServer Pages. http://it.cappuccinonet.com/strutscx/index.php I just took a quick look at it and it looked quite promising at least it offers some documentation and some examples. But I did not had the time to implement it yet - so I cannt tell you if it's worth it. Oliver Hi, Does anyone have any recommendation for add-ons to Struts that replace JSP rendering (or co-exist with) with XML/XSL transforms to produce the UI? I've found a link to Stxx http://stxx.sourceforge.net/ but are there any alternatives? I'd be interested in knowing if anyone has gone down this route, what you chose and how you got on with it. Thanks, Andrew -- Andrew Bate Serco Justice Direct Line: (01452) 880433 Email: [EMAIL PROTECTED] This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee, you must not use, retain or disclose such information. Serco cannot guarantee that the e-mail or any attachments are free from viruses. The views expressed in this e-mail are those of the originator and do not necessarily represent the views of Serco. Nothing in this e-mail shall bind Serco in any contract or obligation. Serco Group plc. Registered in England and Wales. No: 2048608 Registered Office: Serco House, 16 Bartley Wood Business Park, Bartley Way, Hook, Hampshire, RG27 9UY, United Kingdom. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...) jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and XSL ?
I don't have a particular framework or extension to recommend, but I will add that XSLT and JSP can happily be used *together*. JSP is not just HTML. Depending on what you want to do, you can easily use JSTL to do XSLT: %-- xslt is a scoped variable of type String, Reader or javax.xml.transform.Source --% x:transform xslt=${xslt} %-- dynamically generated XML here --% /x:transform Or many other possibilites... Quoting Oliver Thiel [EMAIL PROTECTED]: Hi Andrew, StrutsCX is Struts with XSLT - as alternative to JSP. StrutsCX overcomes the limitations of the Struts Framework by enabling you to utilize XML, XSLT, and XPath technologies instead of its standard JavaServer Pages. http://it.cappuccinonet.com/strutscx/index.php I just took a quick look at it and it looked quite promising at least it offers some documentation and some examples. But I did not had the time to implement it yet - so I cannt tell you if it's worth it. Oliver Hi, Does anyone have any recommendation for add-ons to Struts that replace JSP rendering (or co-exist with) with XML/XSL transforms to produce the UI? I've found a link to Stxx http://stxx.sourceforge.net/ but are there any alternatives? I'd be interested in knowing if anyone has gone down this route, what you chose and how you got on with it. Thanks, Andrew -- Andrew Bate Serco Justice Direct Line: (01452) 880433 Email: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts and XSL ?
Kris, Kris Schneider [mailto:[EMAIL PROTECTED] I don't have a particular framework or extension to recommend, but I will add that XSLT and JSP can happily be used *together*. JSP is not just HTML. We're stuck on J2EE 1.2 using PowerTier - I believe JSTL requires a 1.3 container. This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee, you must not use, retain or disclose such information. Serco cannot guarantee that the e-mail or any attachments are free from viruses. The views expressed in this e-mail are those of the originator and do not necessarily represent the views of Serco. Nothing in this e-mail shall bind Serco in any contract or obligation. Serco Group plc. Registered in England and Wales. No: 2048608 Registered Office: Serco House, 16 Bartley Wood Business Park, Bartley Way, Hook, Hampshire, RG27 9UY, United Kingdom. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts and XSL ?
Okay, so scratch that idea ;-). Quoting Andrew Bate [EMAIL PROTECTED]: Kris, Kris Schneider [mailto:[EMAIL PROTECTED] I don't have a particular framework or extension to recommend, but I will add that XSLT and JSP can happily be used *together*. JSP is not just HTML. We're stuck on J2EE 1.2 using PowerTier - I believe JSTL requires a 1.3 container. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts and XSL ?
hi Andrew, never used, but knowing this candidate: http://it.cappuccinonet.com/strutscx/index.php cheers matthias -Original Message- From: Andrew Bate [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 2:57 PM To: '[EMAIL PROTECTED]' Subject: Struts and XSL ? Hi, Does anyone have any recommendation for add-ons to Struts that replace JSP rendering (or co-exist with) with XML/XSL transforms to produce the UI? I've found a link to Stxx http://stxx.sourceforge.net/ but are there any alternatives? I'd be interested in knowing if anyone has gone down this route, what you chose and how you got on with it. Thanks, Andrew -- Andrew Bate Serco Justice Direct Line: (01452) 880433 Email: [EMAIL PROTECTED] This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee, you must not use, retain or disclose such information. Serco cannot guarantee that the e-mail or any attachments are free from viruses. The views expressed in this e-mail are those of the originator and do not necessarily represent the views of Serco. Nothing in this e-mail shall bind Serco in any contract or obligation. Serco Group plc. Registered in England and Wales. No: 2048608 Registered Office: Serco House, 16 Bartley Wood Business Park, Bartley Way, Hook, Hampshire, RG27 9UY, United Kingdom. - 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]
RE: Struts and XSL ?
I believe the point Kris was trying to make is that, in addition to using JSP to dynamically generate HTML, you can also use JSP to dynamically generate your XSLT stylesheets. This functionality is seperate from JSTL (though you should be able to use at least a subset of the Struts tag libraries). Ian Andrew Bate [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] erco.comcc: Subject: RE: Struts and XSL ? 02/09/2004 09:33 AM Please respond to Struts Users Mailing List Kris, Kris Schneider [mailto:[EMAIL PROTECTED] I don't have a particular framework or extension to recommend, but I will add that XSLT and JSP can happily be used *together*. JSP is not just HTML. We're stuck on J2EE 1.2 using PowerTier - I believe JSTL requires a 1.3 container. This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee, you must not use, retain or disclose such information. Serco cannot guarantee that the e-mail or any attachments are free from viruses. The views expressed in this e-mail are those of the originator and do not necessarily represent the views of Serco. Nothing in this e-mail shall bind Serco in any contract or obligation. Serco Group plc. Registered in England and Wales. No: 2048608 Registered Office: Serco House, 16 Bartley Wood Business Park, Bartley Way, Hook, Hampshire, RG27 9UY, United Kingdom. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: Struts - XML/XSL
Jeff, This looks good, but this may not suit us as well as struts does. We had tough time convincing our mgmt/client to accept struts, no way they can accept another opensource, they are convinced of apache/jakarta projects now. moreover 90% of our screens have to be in HTML. There are few (one Module) wherein we require this XML stuff for hand handelled devices and some Swing clients. If struts does not have this featuer we will have to build it for ourselves. Our seniors as well have liked the approach of a custom tag library. I don't know if I can ask about this in developers forum. Would be nice if someone of the committers could say something on this. Regards Puneet On Mon, 30 Dec 2003 Schnitzer, Jeff wrote : Take a look at the Maverick MVC framework (http://mav.sourceforge.net). It is Struts-like in concept, but you can run any model through an arbitrary pipeline of XSLT (and several other) transformations in Cocoon-like fashion. The pipeline will be efficiently connected with SAX events if appropriate. As an example, you can easily run your model through an XSLT transformation and then through a FOP transformation to send PDF back to the client. Using the optional Domify module, you don't even need JSP to generate the XML in the first place. The Domify adapter uses reflection to create a lazily-loaded DOM façade of your model directly. This is much more efficient than generating and parsing text XML. Try it out :-) Jeff Schnitzer -Original Message- From: Puneet Agarwal [mailto:[EMAIL PROTECTED]] Sent: Friday, December 27, 2002 11:16 AM To: [EMAIL PROTECTED] Subject: Struts - XML/XSL I know that this topic has been dicsussed in this forum a number of times. I came to know this from mail archives, but my question still remains unanswered. In our application we have to generate some XML documents apart from HTML screens. The intent here is to send these XML documents to a Swing client through a socket. there is also a possibility that some of the screens may be required in both HTML and Swing. I have been searching for information on this for past few days. one of the nice option that I cam acorss is described on URL http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html while going through the struts mail archives, I came acorss a mail written by Craig on 06/12/2000 the mail can be accessed on link http://www.servlets.com/archive/servlet/ReadMsg?msgId=18247listName=strut s-dev Here Craig talks about developing some facility within struts which could do the same. Does struts have such a facility. Would be grateful if someone cuold give some tips/links, which could help me in deciding as what is the best option. Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: RE: Struts - XML/XSL
Has anyone successfully developed an XSLT filter that could be used with MVC frameworks yet? -Original Message- From: Puneet Agarwal [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 7:27 AM To: [EMAIL PROTECTED] Subject: Re: RE: Struts - XML/XSL Jeff, This looks good, but this may not suit us as well as struts does. We had tough time convincing our mgmt/client to accept struts, no way they can accept another opensource, they are convinced of apache/jakarta projects now. moreover 90% of our screens have to be in HTML. There are few (one Module) wherein we require this XML stuff for hand handelled devices and some Swing clients. If struts does not have this featuer we will have to build it for ourselves. Our seniors as well have liked the approach of a custom tag library. I don't know if I can ask about this in developers forum. Would be nice if someone of the committers could say something on this. Regards Puneet On Mon, 30 Dec 2003 Schnitzer, Jeff wrote : Take a look at the Maverick MVC framework (http://mav.sourceforge.net). It is Struts-like in concept, but you can run any model through an arbitrary pipeline of XSLT (and several other) transformations in Cocoon-like fashion. The pipeline will be efficiently connected with SAX events if appropriate. As an example, you can easily run your model through an XSLT transformation and then through a FOP transformation to send PDF back to the client. Using the optional Domify module, you don't even need JSP to generate the XML in the first place. The Domify adapter uses reflection to create a lazily-loaded DOM façade of your model directly. This is much more efficient than generating and parsing text XML. Try it out :-) Jeff Schnitzer -Original Message- From: Puneet Agarwal [mailto:[EMAIL PROTECTED]] Sent: Friday, December 27, 2002 11:16 AM To: [EMAIL PROTECTED] Subject: Struts - XML/XSL I know that this topic has been dicsussed in this forum a number of times. I came to know this from mail archives, but my question still remains unanswered. In our application we have to generate some XML documents apart from HTML screens. The intent here is to send these XML documents to a Swing client through a socket. there is also a possibility that some of the screens may be required in both HTML and Swing. I have been searching for information on this for past few days. one of the nice option that I cam acorss is described on URL http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html while going through the struts mail archives, I came acorss a mail written by Craig on 06/12/2000 the mail can be accessed on link http://www.servlets.com/archive/servlet/ReadMsg?msgId=18247listName=st rut s-dev Here Craig talks about developing some facility within struts which could do the same. Does struts have such a facility. Would be grateful if someone cuold give some tips/links, which could help me in deciding as what is the best option. Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RE: RE: Struts - XML/XSL
I found that bit of information in mail archives of struts user list. Hope it helps. Regards Puneet On Mon, 30 Dec 2003 Jacob Hookom wrote : Has anyone successfully developed an XSLT filter that could be used with MVC frameworks yet? -Original Message- From: Puneet Agarwal [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 7:27 AM To: [EMAIL PROTECTED] Subject: Re: RE: Struts - XML/XSL Jeff, This looks good, but this may not suit us as well as struts does. We had tough time convincing our mgmt/client to accept struts, no way they can accept another opensource, they are convinced of apache/jakarta projects now. moreover 90% of our screens have to be in HTML. There are few (one Module) wherein we require this XML stuff for hand handelled devices and some Swing clients. If struts does not have this featuer we will have to build it for ourselves. Our seniors as well have liked the approach of a custom tag library. I don't know if I can ask about this in developers forum. Would be nice if someone of the committers could say something on this. Regards Puneet On Mon, 30 Dec 2003 Schnitzer, Jeff wrote : Take a look at the Maverick MVC framework (http://mav.sourceforge.net). It is Struts-like in concept, but you can run any model through an arbitrary pipeline of XSLT (and several other) transformations in Cocoon-like fashion. The pipeline will be efficiently connected with SAX events if appropriate. As an example, you can easily run your model through an XSLT transformation and then through a FOP transformation to send PDF back to the client. Using the optional Domify module, you don't even need JSP to generate the XML in the first place. The Domify adapter uses reflection to create a lazily-loaded DOM façade of your model directly. This is much more efficient than generating and parsing text XML. Try it out :-) Jeff Schnitzer -Original Message- From: Puneet Agarwal [mailto:[EMAIL PROTECTED]] Sent: Friday, December 27, 2002 11:16 AM To: [EMAIL PROTECTED] Subject: Struts - XML/XSL I know that this topic has been dicsussed in this forum a number of times. I came to know this from mail archives, but my question still remains unanswered. In our application we have to generate some XML documents apart from HTML screens. The intent here is to send these XML documents to a Swing client through a socket. there is also a possibility that some of the screens may be required in both HTML and Swing. I have been searching for information on this for past few days. one of the nice option that I cam acorss is described on URL http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html while going through the struts mail archives, I came acorss a mail written by Craig on 06/12/2000 the mail can be accessed on link http://www.servlets.com/archive/servlet/ReadMsg?msgId=18247listName=st rut s-dev Here Craig talks about developing some facility within struts which could do the same. Does struts have such a facility. Would be grateful if someone cuold give some tips/links, which could help me in deciding as what is the best option. Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Struts XML - XSL
There was an article on JavaWorld regarding struts/XML/XSLT, however, it wasn't clear to me what you are trying to do. If you're using struts you'd most likely use HTTP, not simple sockets. In that case the action perform would return null after setting the response type to text/xml, and writing the xml text to the response. There's not much to say on the topic. It sounds like you're needing some type of UI abstraction layer. There are tons of those out there these days. XForms is prominent. altio.com has one, or you could abstract a UI as XML on your own. Taylor - Original Message - From: Puneet Agarwal [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 27, 2002 11:17 AM Subject: Struts XML - XSL I know that this topic has been dicsussed in this forum a number of times. I came to know this from mail archives, but my question still remains unanswered. In our application we have to generate some XML documents apart from HTML screens. The intent here is to send these XML documents to a Swing client through a socket. there is also a possibility that some of the screens may be required in both HTML and Swing. I have been searching for information on this for past few days. one of the nice option that I cam acorss is described on URL http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html while going through the struts mail archives, I came acorss a mail written by Craig on 06/12/2000 the mail can be accessed on link http://www.servlets.com/archive/servlet/ReadMsg?msgId=18247listName=struts- dev Here Craig talks about developing some facility within struts which could do the same. Does struts have such a facility. Would be grateful if someone cuold give some tips/links, which could help me in deciding as what is the best option. Regards Puneet Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Re: Struts XML - XSL
I am trying to explain as to what exactly do I want to achieve: We are developing an HTML front-end application. But some of our screens require to interact with certain electronic devices. We shall achieve that with the help Java Swing at the Client side. This leads to the fact that some screens may be required both in HTML and Java Swing. We wish that same framework at the backend could be used for this purpose. What I want to discuss here is that how to use struts to generate an HTML and XML both, depending upon type of user. ( Not how will I send the generated XML to Swing through Socket or instead use RMI etc etc). You are right in saying that javaworld has published a good solution, and I sent a link to that approach in my first mail. What I am loking for is that craig said they shall discuss this in developer's forum to develop such a feature in struts. Has this been developed in sturts ? In that mail Craig has suggested number of approaches, the one we liked most is Quote Write a custom tag that you would use to surround all the rest of your JSP page (which would then presumably be generating XML instead of HTML). The nested text would then be passed through an XSL stylesheet specified as an attribute; something like this: struts:xsl stylesheet=x.xsl ... original body of your JSP page ... /struts:xsl This approach has the disadvantage of requiring you to modify every JSP page to include the surrounding tag, but it would be fairly easy to implement. There is a similar tag in the jakarta-taglibs xsl library that we can use as a starting point. Unqoute Regards Puneet On Sat, 28 Dec 2002 Taylor Cowan wrote : There was an article on JavaWorld regarding struts/XML/XSLT, however, it wasn't clear to me what you are trying to do. If you're using struts you'd most likely use HTTP, not simple sockets. In that case the action perform would return null after setting the response type to text/xml, and writing the xml text to the response. There's not much to say on the topic. It sounds like you're needing some type of UI abstraction layer. There are tons of those out there these days. XForms is prominent. altio.com has one, or you could abstract a UI as XML on your own. Taylor - Original Message - From: Puneet Agarwal [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 27, 2002 11:17 AM Subject: Struts XML - XSL I know that this topic has been dicsussed in this forum a number of times. I came to know this from mail archives, but my question still remains unanswered. In our application we have to generate some XML documents apart from HTML screens. The intent here is to send these XML documents to a Swing client through a socket. there is also a possibility that some of the screens may be required in both HTML and Swing. I have been searching for information on this for past few days. one of the nice option that I cam acorss is described on URL http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html while going through the struts mail archives, I came acorss a mail written by Craig on 06/12/2000 the mail can be accessed on link http://www.servlets.com/archive/servlet/ReadMsg?msgId=18247listName=struts- dev Here Craig talks about developing some facility within struts which could do the same. Does struts have such a facility. Would be grateful if someone cuold give some tips/links, which could help me in deciding as what is the best option. Regards Puneet Regards Puneet Agarwal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Struts - XML - XSL
Hello Frédéric, but i don't know how to call the transformation of the XML data with a XSL file to build my final html layout. one option is to use the xsl-taglib (http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html). I haven't seen any problems with struts. ciao mattes
Re: Struts - XML - XSL
At Jakarta, we use Ant to build our HTML pages from XML and XSL. See the Struts source distribution for an example. I haven't tried it, but I keep thinking it would be interesting to do the same with JSPs. This would gives you the flexibility of XML,XLS without changing how you write your applications, or incurring the overhead of the runtime transformations. Frédéric Houbie - ABSIS-GROUP wrote: Hi, I'm involved in a project that use struts. I have a question to get some advice from you. The application want to separate clearly layout from the logic. The team manager want us to use XML, XSL to build html pages. But I don't see clearly how to mix all that. I have beans that do SQL query and return an iterator with the data, I suppose my controller servlet must call the beans and give the jsp access to this iterator. My JSP page will dynamically build XML file, but i don't know how to call the transformation of the XML data with a XSL file to build my final html layout. Can you help me ? Frédéric Houbie Internet Project Manager ABSIS-GROUP SA Centre Socran Av Pré Aily, 8 B-4031 Angleur Tel : +32 4 367 89 64 Fax : +32 4 367 89 63 DISCLAIMER This e-mail and any attachments thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
RE: Struts - XML - XSL
Following are the procedures that can used to apply the style sheet Once we have already parsed the XML document, the getDocument method from the parser instance (e.g. DOMParser) should return an object of type Document (which is actually a DOM representation of the XML). This will be the starting point. To apply the XSLT transformation, you perform the following steps: 1. Create a DOMSource object and implicitly cast it to a SAX InputSource object. The constructor takes in the Document object as a parameter. InputSource source = new DOMSource(document); 2. Instantiate a StyleGenerator object and pass the fully-qualified class names of the XML and XSL parsers you want to use. StyleGenerator stylegen = new StyleGenerator(Consts.SOURCEDOC_PARSER, Consts.STYLESHEET_PARSER); Where: SOURCEDOC_PARSERcom.sengen.utils.DOMParserExtension STYLESHEET_PARSER org.apache.xerces.parsers.SAXParser You can plug-in any DOM / SAX compliant parser you like. In this case we are using two different parsers: a DOM parser for the XML and a SAX parser for the XSL. The setup does not have to be this way. This is also the reason why we have to implicitly casting in step one. 3. Lastly, call the StyleGenerator's applyStylesheet method. Originally, it only deals with filenames but I overloaded it to accomodate InputSource and streams. The resulting or transformed XML document is either written to a file or returned as a byte stream. public void applyStylesheet(String sourceFileName, String styleFileName, String outputFileName) throws Exception public ByteArrayOutputStream applyStylesheet(String sourceFileName, String styleFileName) throws Exception public void applyStylesheet(InputSource sourceInput, String styleFileName, String outputFileName) throws Exception public ByteArrayOutputStream applyStylesheet(InputSource sourceInput, String styleFileName) throws Exception Where: sourceFileName XML filename styleFileName XSL filename ** outputFileName filename of the resulting (transformed) XML sourceInput InputSource object created in step 1 ** any type of stylesheet like XSL-2-HTML, XSL-2-FO, XSL-2-whatever -lines 3 and 4 correspond to steps 1 and 2 above. -In line 7, he used the fourth version of the applyStylesheet method and converted the byte array to a string. This string is now the HTML transformation of the XML document. 1. public String getPresentation() { 2. 3. InputSource source = new DOMSource(getDocument()); 4. StyleGenerator stylegen = new StyleGenerator(KmpPdfgenConsts.SOURCEDOC_PARSER,KmpPdfgenConsts.STYLESHEET_P ARSER); 5. 6. try { 7. return stylegen.applyStylesheet(source,getStylesheet()).toString(); 8. } catch(Exception e){ 9. // 10. } 11. 12. return ; 13. } Hope this helps. Thanks, Ravi -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Monday, September 24, 2001 11:33 AM To: [EMAIL PROTECTED] Subject: Re: Struts - XML - XSL At Jakarta, we use Ant to build our HTML pages from XML and XSL. See the Struts source distribution for an example. I haven't tried it, but I keep thinking it would be interesting to do the same with JSPs. This would gives you the flexibility of XML,XLS without changing how you write your applications, or incurring the overhead of the runtime transformations. Frédéric Houbie - ABSIS-GROUP wrote: Hi, I'm involved in a project that use struts. I have a question to get some advice from you. The application want to separate clearly layout from the logic. The team manager want us to use XML, XSL to build html pages. But I don't see clearly how to mix all that. I have beans that do SQL query and return an iterator with the data, I suppose my controller servlet must call the beans and give the jsp access to this iterator. My JSP page will dynamically build XML file, but i don't know how to call the transformation of the XML data with a XSL file to build my final html layout. Can you help me ? Frédéric Houbie Internet Project Manager ABSIS-GROUP SA Centre Socran Av Pré Aily, 8 B-4031 Angleur Tel : +32 4 367 89 64 Fax : +32 4 367 89 63 DISCLAIMER This e-mail and any attachments thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is prohibited. If you have received this e-mail
re: Struts - XML - XSL
Hi, I don't know if this is what you are looking for but I just purchased a book from Orielly press that deals with Java and XSLT: http://www.oreilly.com/catalog/javaxslt/ I don't know how I can implement this with Struts. Hope this is helpful. Alex
RE: Struts XML/XSL
Yes, We are using XSL as our output format instead of JSP. Here's what we've done: 1) We created a "Message" object that is an ActionForm. All of our ActionForms inherit from this object. This way we enforce that the "Message" object is present for each action and is either in session or request scope and we get all the functionality of Struts' ActionForms. The message object encapsulates and enforces our XML Source Document format. The source document is rendered as a DOM within this object and is used as the source for the XSLT transform. An action's data is copied into this DOM as it is created. 2) We have one JSP that all actions forward to. This JSP contains the XSLT Processor. The JSP pulls the source doc out of the Message object, sucks in the XSL file off the disk, performs the transform and spits out HTML. Advantages - 1) Flexibility. Our clients (or page designers) could write their own pages if they know XSL. They don't have to know Java or JSP or understand our beans or anything like that. We tell them our source doc format and they go off and write pages. We could also support JSP in a combined environment if need be. 2) Productivity. Not having written any JSP tags, I'm not really in a position to say this, but it seems that XSL templates are a lot easier to write than custom tags. And they accomplish most of the same purposes, at least within what we do. Before XSL, we used to write a load of Java scriptlets in our JSP, and XSL works a lot better for us. Plus you can test it in a static environment without the web server running. That's harder to do in JSP. Issues --- 1) Performance. It seems to take longer for the XSLT processor to run than the JSP "processor". We cache our pages so that it works similarly to the JSP compiler. If all of your page data is not in XML you have to DOMify it or otherwise get it into XML before running your page. This can cause performance hits as well. 2) Design. Perhaps the "Message" object could be better designed. It is really only needed at request scope, but since it is an ActionForm, it is usually held at session scope. So it has to be reinitialized on every request to keep stale data out. Maybe it would work better if it was some sort of static thing, or something that was stored in the request to be made available to the JSP. 3) Perhaps the biggest disadvantage in the way we've implemented it is deviation from the Struts architecture. When using Struts the way it was designed you have access to all the custom tags, automatic form population, and other things that we had to try to create on our own. Conclusion --- For us it's worked out well. Our data comes from the backend in XML so it makes sense to leave it there and use XSL to transform it. It also allows us to be very flexible in how we develop our pages and interact with other apps. Performance could be better, but we have yet to test it in a real environment. That will come soon. If we could do it all again (and I'm sure we will eventually) we'd probably make some tweaks in the design, but my opinion is that you can make Struts work very well with XSLT, even if you have to make some extensions to the system to do it right. Hope that helps. Greg -Original Message- From: [EMAIL PROTECTED] Sent: Tuesday, April 03, 2001 12:22 PM To: [EMAIL PROTECTED] Subject: Struts XML/XSL Has any one integrated struts with XML/Xsl? I'd like to know a few thoughts/issues/ideas/patterns on that. Thanks, Ven __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: struts and XSL
[EMAIL PROTECTED] wrote: There are many competing technologies to embrace the Model 2 pattern. I get the feeling that XML/XSL and Struts are mutually exclusive. Is this a valid concern ?? I'm not sure that they are mutually exclusive, but there is a choice you ned to make for the "outermost" controlling architecture for your web application. If your application is primarily content publishing, with data based primarly in XML, you owe it to yourself to consider a framework like Cocoon, which is aimed at precisely this type of environment. That doesn't prohibit you from using the Struts custom tag library (if your presentation is in JSP pages), but you probably will not need the Struts controller environment. If your application is primarily a dynamic business app, you owe it to yourself to consider the controller framework inside Struts. This doesn't prohibit you from using XML, XSLT, and XSP -- you can still use them to create portions of the content of your pages -- but you probably will not need the Cocoon site map capabilities. [EMAIL PROTECTED] Craig McClanahan