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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
Xslt 为什么这个选择总是正确的?_Xslt_Saxon - Fatal编程技术网

Xslt 为什么这个选择总是正确的?

Xslt 为什么这个选择总是正确的?,xslt,saxon,Xslt,Saxon,在XSLT文件中,我定义了一个函数 <xsl:function name="my:isValidDate"> <xsl:param name="orgDate" /> <xsl:value-of select="boolean(string-length($orgDate)=10)" /> </xsl:function> 测试日期字符串是否具有有效长度。 当我使用这个函数时 <xsl:choose>

在XSLT文件中,我定义了一个函数

<xsl:function name="my:isValidDate">
    <xsl:param name="orgDate" />

    <xsl:value-of select="boolean(string-length($orgDate)=10)" />
</xsl:function>

测试日期字符串是否具有有效长度。 当我使用这个函数时

        <xsl:choose>
            <xsl:when test="my:isValidDate(ValidFrom)">
                <xsl:call-template name="formatDate"><xsl:with-param name="orgDate" select="ValidFrom"></xsl:with-param></xsl:call-template>
            </xsl:when>
            ...
        </xsl:choose>

...
这似乎总是真的;即使是像
这样的空标记也能通过测试并导致奇怪的输出,因为不能对空的或无效的日期字符串调用模板。当我为调试问题从输出
ValidFrom时,它按预期为空。我还在函数中尝试了
字符串长度($orgDate)=10
等变体,但似乎没有任何效果。 我错过了什么

编辑:当我内联函数时,这个条件被正确计算了

基本上
创建一个带有布尔值字符串的文本节点,若要返回布尔值,请使用

显示一个,以便我们可以尝试重现该问题。谢谢