[英]wso2 esb saxon ee configuration
I'm trying to use the XSLT Mediator but when taking a value, i'd like to apply a custom groovy function to it. 我正在尝试使用XSLT介体,但是在获取值时,我想对其应用自定义的Groovy函数。 For example:
例如:
<script language="groovy">
def myfunction(value) {
return "A B C";
}
</script>
<xsl:template match="/">
<urn:item>
<urn:productName>
<xsl:value-of select="myfunction(PRODUCTNAME)"/>
</urn:productName>
</urn:item>
</xsl:template>
The error i'm getting is: net.sf.saxon.trans.XPathException: Cannot find a matching 1-argument function named myfunction() 我得到的错误是: net.sf.saxon.trans.XPathException:找不到名为myfunction()的匹配1参数函数
As i read, Saxon HE (the default xslt processor in wso2esb) is not able to call extension functions but Saxon PE or EE does. 如我所读,Saxon HE(wso2esb中的默认xslt处理器)无法调用扩展功能,但Saxon PE或EE可以。
I follow steps detailed here ( http://nandikajayawardana.blogspot.com.ar/2012/12/how-to-replace-saxonhe940wso2v1jar-in.html ) but same error. 我遵循此处详细介绍的步骤( http://nandikajayawardana.blogspot.com.ar/2012/12/how-to-replace-saxonhe940wso2v1jar-in.html ),但存在相同的错误。
My question is: Is there another way to do what i need? 我的问题是:还有其他方法可以满足我的需求吗? How can i know that wso2 esb is loading properly Saxon EE?
我怎么知道wso2 esb正在正确加载Saxon EE?
Thank you very much for your help! 非常感谢您的帮助!
Regards, R. 问候,河。
===================================================== ================================================== ===
Solved! 解决了!
Follow @Carpentidge steps to install Saxon EE in WSO2ESB. 按照@Carpentidge步骤在WSO2ESB中安装Saxon EE。
Following @MichaelKay link, i used Java to do what i need 在@MichaelKay链接之后,我使用Java来完成所需的操作
First, download common-lang3.jar.zip and copy the .jar file into repository/components/lib. 首先,下载common-lang3.jar.zip并将.jar文件复制到repository / components / lib中。 Then, modify the xslt as follows:
然后,如下修改xslt:
<xsl:template match="/">
<xsl:variable name="pn" select="CSITPRODUCTNAME"/>
<urn:item>
<urn:productName>
<xsl:value-of select="lang:unescapeHtml($pn)" xmlns:lang="java:org.apache.commons.lang.StringEscapeUtils"/>
</urn:productName>
</urn:item>
</xsl:template>
Thank you both for your help @Carpentidge and @MichaelKay 谢谢你们两个的帮助@Carpentidge和@MichaelKay
Saxon doesn't support extension functions written in groovy, and it doesn't recognize the <script>
element in a stylesheet file. Saxon不支持以groovy编写的扩展功能,并且无法识别样式表文件中的
<script>
元素。 Saxon's mechanisms for defining extension functions are described here: Saxon定义扩展功能的机制在此处描述:
http://www.saxonica.com/documentation/#!extensibility http://www.saxonica.com/documentation/#!extensibility
The manual for replaxing saxon you reference is not for the ESB :) To replace saxon for the esb, put the saxon9ee.jar
in the ESB_HOME\\lib\\endorsed
folder and remove the saxon_HE file. 替换您参考的saxon的手册不适用于ESB :)要替换esb的saxon,请将
saxon9ee.jar
放在ESB_HOME\\lib\\endorsed
文件夹中,然后删除saxon_HE文件。 Put the license file in the ESB_HOME
folder (you can request a temporary one from saxonica.com) and restart the ESB. 将许可证文件放入
ESB_HOME
文件夹(您可以从saxonica.com请求一个临时文件),然后重新启动ESB。 I had some difficulties using 9.6.0 so I'd say use 9.5.1. 我在使用9.6.0时遇到了一些困难,所以我会说使用9.5.1。 http://www.saxonica.com/download/download_page.xml
http://www.saxonica.com/download/download_page.xml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.