小编Pet*_*etr的帖子

在 XSLT 1.0 中的变量中使用 max

我可以在 XSLT 1 的变量中使用 max 函数吗?我需要在某些节点内找到最大值,并且需要从更多地方调用它。所以我尝试创建一个模板:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
 xmlns:essox="urn:essox-scripts">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template name="Field001_max_dluznych_splatek">
        <xsl:param name="CrRep"/>
        <xsl:variable name="PocetDluznychSplatekSplatky">
            <xsl:value-of
             select="max($CrRep
                         /Response
                          /ContractData
                           /Installments
                            /InstDetail
                             /NrOfDueInstalments)" />
        </xsl:variable>
        <xsl:variable name="PocetDluznychSplatekKarty">
            <xsl:value-of
             select="max($CrRep
                          /Response
                           /ContractData
                            /Cards
                             /CardDetail
                              /NrOfDueInstalments)" />
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="$PocetDluznychSplatekSplatky
                             &gt;= $PocetDluznychSplatekKarty">
                <xsl:value-of select="$PocetDluznychSplatekSplatky"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$PocetDluznychSplatekKarty"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

在 XML Spy 中我收到此错误:

Error in XPath expression Unknown function - Name and number of arguments do not match any function signature in …

xslt max

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

max ×1

xslt ×1