I'm trying to pass a parameter to an XSL file with jcabi-xml
. The code is simple and I can confirm that it executes:
final XSL xsl = new XSLDocument(Main.class.getResourceAsStream("test.xsl"));
xsl.with("test", "TestValue");
XSL file:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="test" select="''"/>
<xsl:template match="/">
...
<p><xsl:value-of select="$test"/></p>
...
</xsl:template>
</xsl:stylesheet>
However, the output is blank. Am I calling the wrong function? Is there something else I should be doing?
xsl.with
does not store the parameter in the same xsl
variable but returns a new XSL
object. So you need to write
xsl = xsl.with("test", "TestValue");
and then run the transformation.