在 XSLT 1.0 中使用 EXSLT 日期和时间模块会产生未知错误
我在 XSLT 1.0 文件中添加了 EXSLT 日期和时间模块,声明如下:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">
这不会影响生成的页面,但是当我尝试使用以下命令调用实际日期时:
<xsl:value-of select="date:date-time()"/>
我收到一条“加载样式表时出错:未知错误加载我的页面时发生 ()”消息。 有人对我可能缺少的内容有什么建议吗?提前致谢!
I added the EXSLT dates-and-times module in my XSLT 1.0 file by declaring:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">
This doesn't affect my resulting page, but when I try to call the actual date with:
<xsl:value-of select="date:date-time()"/>
I receive an "Error loading stylesheet: An unknown error has occurred ()" message when loading my page.
Does anyone have a suggestion as to what I might be missing? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这意味着您正在使用的特定 XSLT 处理器未实现 EXSLT(或仅实现 EXSLT 的日期时间模块)。
这是一个小转换:
当使用 Saxon 6.5.4 XSLT 1.0 处理器应用于任何 XML 文档(未使用)时,会生成正确的结果:
解决方案:
要么使用实现 EXSLT 的 XSLT 1.0 处理器,要么将当前日期时间作为参数传递给转换。
如果使用 XSLT 2.x,只需使用 XPath 2.0 函数
current-dateTime()
。This means that the particular XSLT processor you're using doesn't implement EXSLT (or just the date-time module of EXSLT).
Here is a small transformation:
when applied to any XML document (not used), with the Saxon 6.5.4 XSLT 1.0 processor, the correct result is produced:
Solution:
Either use an XSLT 1.0 processor that implements EXSLT, or pass the current date-time as a parameter to the transformation.
If using XSLT 2.x, just use the XPath 2.0 function
current-dateTime()
.