【问题标题】:Error XalanXPathException when using hours-from-duration xpath function in ibm db2 xslt transformation在 ibm db2 xslt 转换中使用 hours-from-duration xpath 函数时出错 XalanXPathException
【发布时间】:2011-02-10 00:01:21
【问题描述】:

输入 XML:
<test><TotalDuration>PT1H32M7S</TotalDuration></test>

输入 XSLT:
<?xml version="1.0"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions"> <xsl:template match="/test"> Hours=<xsl:value-of select="fn:hours-from-duration(TotalDuration)"/> hr </xsl:template> </xsl:stylesheet>

预期输出: 小时=1 小时

取而代之: [IBM][DB2/NT64] SQL16280N XSLT 处理器返回以下错误:“XalanXPathException: The function number 'http://www.w3.org/ 2005/xpath”。 SQLSTATE=225X0

【问题讨论】:

  • 我看到了XalanXpathException。这可能意味着您实际上使用的是 Xalan XSLT 处理器,它是 XSLT 1.0 处理器,而不是 XSLT 2.0 处理器。

标签: xpath db2 xslt-2.0


【解决方案1】:

预期输出:小时=1 小时

取而代之的是:[IBM][DB2/NT64] SQL16280N XSLT 处理器返回 以下错误: “XalanXPathException:函数 编号“http://www.w3.org/2005/xpath”。 SQLSTATE=225X0

这很清楚:您使用的 XSLT 处理器 (Xalan) 没有实现 XSLT 2.0。

您只需将 XSLT 2.0 代码提供给实现 XSLT 2.0 的 XSLT 处理器。

【讨论】:

  • 转换发生在DB2 数据库中,即XSLT 处理器在db2 中。不确定 DB2 数据库支持哪些 xslt 处理器。
  • @pdshah:众所周知,目前还没有 Xalan XSLT 2.0 处理器。并且错误消息将处理器标识为“Xalan”。那么,有什么不清楚的地方吗?您不能将 XSLT 2.0 样式表提供给 XSLT 1.0 处理器。句号。
  • @Alejandro 感谢您的快速回复。这是有道理的,Xlang 实现了 xslt 1 并因此引发异常。只是想知道我是否可以将 DB2 配置为使用像 Saxon 这样的另一个引擎。似乎 IBM 也有自己的 XSLT 2.0 引擎ref。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-31
  • 1970-01-01
  • 2012-03-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多