【发布时间】:2018-09-29 06:35:42
【问题描述】:
我正在为我的项目使用 Fuse 6.1 和 camel 2.12 版本并面临以下问题。我正在尝试将 java.util.HashMap 传递给我的 xslt 并访问 map 以检索我的 XSLT 中的一堆值。为此,我正在构建一个映射并将其放在 bean 中的 in 标头中并访问它 XSLT。我创建了一个测试用例来运行这条路线,一切正常,能够在 XSLT 中访问地图,如果我的类路径中有 net.sf.saxon/saxon/8.9.0.4,XSLT 正在编译并生成预期的 XML,但如果我尝试在具有骆驼撒克逊功能的 fuse 6.1 中部署相同的路线,但失败并出现以下错误。后来我意识到并用 pom 文件中的骆驼撒克逊依赖替换了 net.sf.saxon jar 文件,并且同一路由的测试用例失败了。问题是如何使用骆驼撒克逊功能使其运行。
这是我的路线
<route id="newCustomerMapToXmlTransformationRoute">
<from uri="direct:newCustomerMapToXmlTransformation" />
<to uri="customerIdGenerationProcessor" />
<to uri="xslt:xslt/flatFileToCustomer.xsl?transformerFactory=tFactory&failOnNullBody=false" />
<removeHeader headerName="customerProfileMap" />
</route>
XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:Map="java.util.HashMap" exclude-result-prefixes="Map"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<xsl:variable name="sourceName" select="Map:get($customerProfileMap,'aaaa')"/>
</xsl:stylesheet>
Getting following error:
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
[ main] XsltErrorListener ERROR Cannot find a matching 2-argument function named {java.util.HashMap}get(). Note that direct calls to Java methods are not available under Saxon-HE;
net.sf.saxon.trans.XPathException: Cannot find a matching 2-argument function named {java.util.HashMap}get(). Note that direct calls to Java methods are not available under Saxon-HE
我花了很多时间寻找解决方案,但找不到任何解决方案。谁能帮我解决这个问题?从 fuse 中卸载 camel-saxon 功能并使用 net.sf.saxon jar 是否有意义?
【问题讨论】:
标签: apache-camel xslt-2.0 saxon jbossfuse apache-servicemix