【问题标题】:XSLT running in anypoint studio but not running in CloudHubXSLT 在 anypoint studio 中运行,但不在 CloudHub 中运行
【发布时间】:2015-02-13 14:32:12
【问题描述】:

您好,我正在使用 xslt 转换器并使用 xsl 文件,我正在使用函数 ex:date-time(),它在 Anypoint 工作室中运行,但是当我尝试在 cloudHub 中运行时,它会抛出错误
找不到一个匹配的 0 参数函数,名为 {http://exslt.org/dates-and-times}date-time()。没有本地名称日期时间的撒克逊扩展函数(net.sf.saxon.trans.XPathException)

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	exclude-result-prefixes="xs ">
	<xsl:output method="xml" encoding="UTF-8" indent="yes" />
	<xsl:template match="/">
		<xsl:variable name="var1" select="." />
		<_ord:testOrder 
			xmlns:ex="http://exslt.org/dates-and-times" extension-element-prefixes="ex"
		
			<xsl:attribute name="xsi:schemaLocation"
				namespace="http://www.w3.org/2001/XMLSchema-instance">
				<xsl:value-of select="test" />
			</xsl:attribute>
			<_wcf:ApplicationArea>
			<_oa:CreationDateTime><xsl:value-of select="ex:date-time()"/></_oa:CreationDateTime>
			
			</_wcf:ApplicationArea>
			
	         </_ord:testOrder>
			
	  </xsl:template>
</xsl:stylesheet>

【问题讨论】:

  • 显然 Anypoint studio 支持 EXSLT,但 Cloudhub 不支持。如果你显示代码,也许有一个不使用这个函数的变通方法?
  • 嗨,Mathias 在上面添加了 xslt 代码
  • 有什么办法可以在 cloudhub 中添加任何 EXSLT jar
  • 名为 net.sf.saxon.trans.XPathException 的异常表明正在使用 Saxon 8 或 9。在这种情况下,请考虑简单地编写 XSLT 2.0,其内置支持 xs:datexs:dateTime 数据类型和函数,如 w3.org/TR/xquery-operators/#func-current-dateTime,而不是尝试使用对 EXSLT 扩展支持不佳的 XSLT 1.0。
  • 考虑在您的机器上本地在 Mule Standalone 上测试您的应用程序:它应该会像在 CloudHub 中一样失败,这样您就可以更轻松地寻找解决方法。

标签: xml xslt mule mule-studio cloudhub


【解决方案1】:

需要单独的许可证才能使用这些功能。我认为您使用的是 Saxon 的 HE。获取 Saxon 的企业版

【讨论】:

  • 谢谢我明白了。我用java解决了这个问题
【解决方案2】:

CloudHub 倾向于使用最新最好的 Mule 版本。在 3.6 中,已经完成了一个 huge overhaul 的 XML 依赖项。

我的猜测是您可能正在针对 3.5 测试本地化,然后针对 3.6 在 cloudhub 中运行。请尝试将您的 cloudhub 配置设置为使用 3.5。

【讨论】:

  • 在 cloudhub 中,我在开发环境中工作,它使用的是 saxon HE,所以 exslt 不支持
【解决方案3】:

当通过 xslt 转换器引用 xsl 文件时,它采用 xsl 文件的完整路径, 所以我怀疑路径没有被修改,所以在将项目部署到 cloudhub 时它正在执行。

所以在通过 xslt 转换器引用 xsl 文件后,修改路径,将资源文件夹视为根目录。

【讨论】:

  • 它正在获取文件,但问题是 exslt 功能不起作用
猜你喜欢
  • 2021-03-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-28
相关资源
最近更新 更多