Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 未知函数Current-Datetime()_Xml_Xslt_Saxon - Fatal编程技术网

Xml 未知函数Current-Datetime()

Xml 未知函数Current-Datetime(),xml,xslt,saxon,Xml,Xslt,Saxon,有人能解释一下为什么我在这个XSLT中得到了current-datetime()的未知函数吗?我在Saxon 9.6.0.7中使用Oxy。我认为在当前的saxon中使用XSLT2.0,直接调用current-datetime(): 通常错误是在需要XSLT 2.0的地方使用XSLT 1.0处理器,但这里的问题是函数调用的情况:函数名是,而不是current-datetime()我肯定知道1.0v2.0。他肯定不知道这件事。为了让它正常工作,我犯了错误,添加了xpath默认名称空间。这才是真正

有人能解释一下为什么我在这个XSLT中得到了
current-datetime()
的未知函数吗?我在Saxon 9.6.0.7中使用Oxy。我认为在当前的saxon中使用XSLT2.0,直接调用
current-datetime()



通常错误是在需要XSLT 2.0的地方使用XSLT 1.0处理器,但这里的问题是函数调用的情况:函数名是,而不是
current-datetime()

我肯定知道1.0v2.0。他肯定不知道这件事。为了让它正常工作,我犯了错误,添加了xpath默认名称空间。这才是真正把我搞砸的地方
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:mns="urn:com.mydom.custom/MyNameSpace"
xpath-default-namespace="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsd">
<xsl:template match="InputFileRoot">  
     <mns:TransData> 
                    <xsl:if test="string-length(Record61/ValueDate) > 0">
                        <mns:TransactionDate>   
                            <xsl:call-template name="formatdate">
                                <xsl:with-param name="DateTimeStr" select="Record61/ValueDate"/>
                                <!--  <xsl:value-of select="format-dateTime(Record61/ValueDate,'[Y01]-[M01]-[D01]')" /> -->
                            </xsl:call-template>
                        </mns:TransactionDate>
                    </xsl:if>

                    <xsl:if test="string-length(SupplementaryDetails) > 0">
                        <mns:Addenda>
                            <xsl:value-of select="SupplementaryDetails" />
                        </mns:Addenda>
                    </xsl:if>

                    <xsl:if test="string-length(Record61/AccountServicingInstitutionsReference) > 0">
                        <mns:BankReferenceNumber>
                            <xsl:value-of select="Record61/AccountServicingInstitutionsReference" />
                        </mns:BankReferenceNumber>
                    </xsl:if>

                    <mns:CustomerReferenceNumber>
                        <xsl:value-of select="Record61/ReferenceForTheAccountOwner" />
                    </mns:CustomerReferenceNumber>                      
                </mns:TransData>              
</xsl:template>

<xsl:template name="formatdate">
    <xsl:param name="DateTimeStr" />

    <xsl:variable name="CurDate">
        <xsl:value-of  select="current-datetime()"/>
    </xsl:variable>

    <xsl:variable name="mm">
        <xsl:value-of select="substring($DateTimeStr,3,2)" />
    </xsl:variable>

    <xsl:variable name="dd">
        <xsl:value-of select="substring($DateTimeStr,5,2)" />
    </xsl:variable>

    <xsl:variable name="yyyy">
        <xsl:value-of select="concat(substring($CurDate,1,2),substring($DateTimeStr,1,2))" />
    </xsl:variable>

    <xsl:value-of select="concat($yyyy,'-', $mm, '-', $dd)" />
</xsl:template>