日安!我下载了Altova XMLSpy试用版,安装了FOP0.95,并尝试执行XSLT1.0版转换。我的模板是有效的,但在转换期间,它在包含"date-time()“函数的行上失败:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:dt="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="dt exsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="dt:date-time()"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>错误消息为:
Error in XPath expression
Unknown function - Name and number of arguments do not match any function signature in
the static context - 'http://exslt.org/dates-and-times:date-time'请问如何使此功能可用?我确信这个函数是存在的。例如,该模板可以在以下在线XSLT测试器中工作:http://markbucayan.appspot.com/xslt/index.html
提前谢谢你!Vojtech
更新:我安装了SAXON 9( HE和EE),将ALTOVA配置为使用它,但还是出现了相同的错误。
发布于 2012-03-14 20:06:03
如果你正在使用Altova或saxon,你可以使用XSLT2而不是XSLT1,所以不需要加载EXSLT扩展,xpath2内置了这个函数
select="current-dateTime()"http://www.w3.org/TR/xpath-functions/#func-current-dateTime
发布于 2013-07-30 15:40:50
`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" extension-element-prefixes="msxsl" xmlns:local="urn:local>
<msxsl:script language="CSharp" implements-prefix="local">
public string dateTimeNow()
{
return DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");
}
</msxsl:script> </xsl:stylesheet>`然后像这样使用<xsl:param name="dnes" select="local:dateTimeNow()"/>
发布于 2013-07-30 17:03:37
请使用支持XSL 2.0的Altova xml spy 9版本。
谢谢,阿迪亚
https://stackoverflow.com/questions/9698904
复制相似问题