【发布时间】: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:date和xs:dateTime数据类型和函数,如 w3.org/TR/xquery-operators/#func-current-dateTime,而不是尝试使用对 EXSLT 扩展支持不佳的 XSLT 1.0。 -
考虑在您的机器上本地在 Mule Standalone 上测试您的应用程序:它应该会像在 CloudHub 中一样失败,这样您就可以更轻松地寻找解决方法。
标签: xml xslt mule mule-studio cloudhub