小编uL1*_*uL1的帖子

XSLT函数返回不同的结果[Saxon-EE vs Saxon-HE/PE]

我目前正在使用各种版本的Saxon-Processor进行纯XSL转换.下面是我的简短样式表,简化了我的问题的需求:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:foo="bar">

    <xsl:output encoding="UTF-8" method="text"/>

    <xsl:template match="/">
        <xsl:text>Call of func_1: </xsl:text>        
        <xsl:value-of select="foo:func_1()"/>

        <xsl:text>&#xA;Call of func_1: </xsl:text>
        <xsl:value-of select="foo:func_1()"/>

        <xsl:text>&#xA;Call of func_1: </xsl:text>
        <xsl:value-of select="foo:func_1()"/>

        <xsl:text>&#xA;Call of func_2: </xsl:text>
        <xsl:value-of select="foo:func_2()"/>
    </xsl:template>

    <xsl:function name="foo:func_1" as="xs:string">
        <!-- do some other stuff -->
        <xsl:value-of select="foo:func_2()"/>
    </xsl:function>

    <xsl:function name="foo:func_2" as="xs:string">
        <xsl:variable name="node">
            <xsl:comment/>
        </xsl:variable>
        <xsl:sequence select="generate-id($node)"/>
    </xsl:function>

</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

描述

foo:func_1是一个包装函数,用于返回第二个函数的值+执行其他操作,可以忽略.这个函数调用的概念是强制性的!

foo:func_2为元素生成唯一的id.此元素在名为"node"的本地范围变量中创建.

基于Saxon版本的不同结果

预期结果:

Call of func_1: d2
Call of func_1: d3
Call of func_1: …
Run Code Online (Sandbox Code Playgroud)

xml xslt xpath saxon xslt-2.0

8
推荐指数
1
解决办法
309
查看次数

标签 统计

saxon ×1

xml ×1

xpath ×1

xslt ×1

xslt-2.0 ×1