[英]How to call a java object function from xslt
I am using xalan to make xml/xslt transformation.我正在使用 xalan 进行 xml/xslt 转换。 I can pass a Java object to xslt using我可以使用 Java object 到 xslt
transformer.setParameter("parameterName",parameterValue);
Also I can get this value from xslt but I want to call I function from xslt that parameterValue has.我也可以从 xslt 获得这个值,但我想从参数值具有的 xslt 调用我 function。 Let's assume I innitialize parameterValue假设我初始化了 parameterValue
ParameterValue parameterValue = new ParameterValue("value");
and ParameterValue has a function called getValue.并且 ParameterValue 有一个名为 getValue 的 function。 How can I call this function from xslt.我怎么能从 xslt 调用这个 function。
I tried;我试过了;
<xsl:value-of select="$parameterName:getValue()">
and和
<xsl:value-of select="$parameterName.getValue()">
but none worked.但没有一个工作。 How can I do this?我怎样才能做到这一点?
The documentation athttps://xalan.apache.org/xalan-j/extensions_xsltc.html#java_ext suggests to use: https://xalan.apache.org/xalan-j/extensions_xsltc.html#java_ext的文档建议使用:
<xsl:stylesheet xmlns:pv="http://xml.apache.org/xalan/java/ParameterValue" ...>
<xsl:value-of select="pv:getValue($parameterName)"/>
Make sure, if ParameterValue
lives in a package (eg example.com.ParameterValue
) that you use that with eg确保,如果ParameterValue
存在于 package (例如example.com.ParameterValue
)中,您将其与例如
<xsl:stylesheet xmlns:pv="http://xml.apache.org/xalan/java/example.com.ParameterValue" ...>
<xsl:value-of select="pv:getValue($parameterName)"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.