|
From: Estes, J. D - S. L. M. <jam...@us...> - 2005-02-17 17:45:18
|
I seem to remember a post somewhere talking about something similar...not sure where/when though. However, there is a JIRA issue that addresses the "...eliminating the need for an additional action-servlet.xml file" point: http://opensource.atlassian.com/projects/spring/browse/SPR-667 James -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of David Bowers Sent: Thursday, February 17, 2005 9:19 AM To: spr...@li... Subject: [Springframework-developer] xsl transforms I've been thinking about an extension to the mechanism for specifying XML sources for Spring beans, where you specify an XML source and an XSL transform. Something like this: <context-param> <param-name>contextConfigLocation</param-name> <param-value> WEB-INF/normalContext.xml,=20 WEB-INF/cusomtContext.xml | WEB-INF/transformCustomContext.xsl </param-value> In the example above, the new ResourcePatternResolver would look for a | "operator", and "pipe" the first xml file through the second xsl transform, and use the result to build the BeanFactory.. And to be more ambitious, maybe someone could do something like this when using the Struts plugin. If you turned validation off on the struts parsing, you could mix in certain spring document elements, and transform the struts-config into a spring context file, possibly eliminating the need for an additional action-servlet.xml file. <plug-in className=3D"org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property=3D"contextConfigLocation"=20 value=3D"/WEB-INF/struts-config.xml | /WEB-INF/struts-transform.xsl"/> </plug-in> Another benefit of this is it could make it easier for someone to define common beans. Instead of <bean class=3D"com.abc.domain.Entry"> <constructor-arg = index=3D"0"><value>someKey</value></constructor-arg> <constructor-arg index=3D"1"><value>someValue</value></constructor-arg> </bean> which is very wordy if you specify 10 or 15 of those objects, you could write an xsl transform that would produce the above output from this: <entry key=3D"someKey" value=3D"someValue"/> I haven't researched exactly where in the Spring code this would have to be extended (it looks like it would just involve extending some of the implementations of ResourcePatternResolver). Before I work on it (and no promises), I'm curious if this interests anyone else? If so, any thoughts on what the XSL transform "operator" should be? "|" is quite intuitive to me, but it could be any of the following: custom.xml * transform.xsl transform(custom.xml, transform.xsl) // If very ambitious, allow a user to "plug-in" implementations of the function transform:/(custom.xml, transform.xsl) //Looks more like a URI /David Bowers ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |