I am performing XSLT conversion from my java web application without problems:
Transformer transformer = TransformerFactory.newInstance().newTransformer(xslSource);
transformer.transform(xmlInput, xmlOutput);
In my XSLT transformation, I now add a function call document()to load a RESTful web service response:
<xsl:variable name="url">
http://server/service?id=<xsl:value-of select="@id"/>
</xsl:variable>
<xsl:call-template name="doMoreStuff">
<xsl:with-param name="param1" select="document($url)/foo"/>
</xsl:call-template>
Good cool, no problem. But now I want to read the base URL from the utils class in java and pass it to the stylesheet.
//java
String baseUrl = myUtils.getBaseUrl();
<xsl:variable name="url">
<xsl:value-of select="$baseUrl"/>
<xsl:text>/service?id=</xsl:text>
<xsl:value-of select="@id"/>
</xsl:variable>
Any suggestion on how to do this? My Java utils class loads the value from the myApp.properties file into the classpath, but I'm not sure I can use this from XSLT ...
source
share