[ https://issues.apache.org/activemq/browse/SM-705?page=all ]
Guillaume Nodet resolved SM-705. -------------------------------- Fix Version/s: 3.1 Resolution: Fixed Author: gnodet Date: Sun Oct 15 13:30:11 2006 New Revision: 464270 URL: http://svn.apache.org/viewvc?view=rev&rev=464270 Log: SM-705: Static Parameter map injected into XsltComponent Added: incubator/servicemix/trunk/servicemix-components/src/test/java/org/apache/servicemix/components/xslt/XsltParameterTest.java incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/xslt/parameter-test.xsl incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/xslt/servicemix-parameter-test.xml Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/xslt/XsltComponent.java Author: gnodet Date: Sun Oct 15 13:30:14 2006 New Revision: 464271 URL: http://svn.apache.org/viewvc?view=rev&rev=464271 Log: SM-705: Static Parameter map injected into XsltComponent Added: incubator/servicemix/trunk/servicemix-saxon/src/test/resources/parameter-test.xsl Modified: incubator/servicemix/trunk/servicemix-saxon/src/main/java/org/apache/servicemix/saxon/SaxonEndpoint.java incubator/servicemix/trunk/servicemix-saxon/src/main/java/org/apache/servicemix/saxon/XQueryEndpoint.java incubator/servicemix/trunk/servicemix-saxon/src/main/java/org/apache/servicemix/saxon/XsltEndpoint.java incubator/servicemix/trunk/servicemix-saxon/src/test/java/org/apache/servicemix/saxon/SaxonComponentTest.java incubator/servicemix/trunk/servicemix-saxon/src/test/resources/spring.xml Author: gnodet Date: Sun Oct 15 13:30:18 2006 New Revision: 464272 URL: http://svn.apache.org/viewvc?view=rev&rev=464272 Log: SM-705: Static Parameter map injected into XsltComponent Added: incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/test/java/org/apache/servicemix/components/xslt/XsltParameterTest.java incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/test/resources/org/apache/servicemix/components/xslt/parameter-test.xsl incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/test/resources/org/apache/servicemix/components/xslt/servicemix-parameter-test.xml Modified: incubator/servicemix/branches/servicemix-3.0/servicemix-components/src/main/java/org/apache/servicemix/components/xslt/XsltComponent.java > Static Parameter map injected into XsltComponent > ------------------------------------------------ > > Key: SM-705 > URL: https://issues.apache.org/activemq/browse/SM-705 > Project: ServiceMix > Issue Type: New Feature > Components: servicemix-components > Affects Versions: 3.0.1 > Environment: NA > Reporter: Ramon Buckland > Assigned To: Guillaume Nodet > Priority: Minor > Fix For: 3.0.1, 3.1 > > Attachments: xslt-parameters.patch > > Original Estimate: 20 minutes > Remaining Estimate: 20 minutes > > This patch is an enhancement for the XsltComponent. > We had a requirement whereby we wanted to inject a "System Variable" into the > XSLT so we could use it's value as part of the > transformation process. > eg: > java -Dsome.system.property=SomeValue .... > In the servicemix.xml file where the XsltComponent is defined you can now add > a map of parameters. > <sm:activationSpec componentName="transformer" > service="foo:transformer"> > <sm:component><bean > class="org.apache.servicemix.components.xslt.XsltComponent"> > <property name="xsltResource" value="classpath:mytransform.xsl"/> > <property name="xsltParameters"> > <map> > <entry key="stringParam" value="staticString"/> > <entry key="someProperty" value="${some.system.property}"/> > <entry key="bean" value-ref="someBeanRef"/> > </map> > </property> > </bean></sm:component> > And, as are properties on the JBI message added in, we also add these > parameters to the XSLT. > Of course you need to declare your intention to use the properties. > <xsl:stylesheet > xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > version='1.0'> > <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/> > <xsl:param name="stringParam"/> > <xsl:param name="someProperty"/> > <xsl:param name="bean"/> > .... > </xsl:stylesheet> > A handy Hint, we use this in a real world by using the Spring > PropertyPlaceholder, the properties files sit outside > the SU's and SA's and we can then change "behaviour" really easily by > adjusting our properties. > <beans xmlns:spring="http://xbean.org/schemas/spring/1.0"> > <bean id="propertyConfigurer" > > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> > <property name="locations"> > <list> > <value>classpath:myproperties.properties</value> > </list> > </property> > </bean> > </beans> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira