XSLT 1.0 传递调用模板一组节点名称([a1, a2, a3] 中 x 的模拟)

XSLT 1.0 pass to call-tempate a set of node names (analog of x in [a1, a2, a3])

它是 问题的扩展。

我有一个 XML 这样的片段

<lines>
    <item><code>1.1</code><amt>1000.00</amt></item>
    <item><code>1.3.1</code><amt>2000.00</amt></item>
    <item><code>1.3.2</code><amt>3000.00</amt></item>
    <item><code>2.1</code><amt>4000.00</amt></item>
    ...
</lines>

我想添加一些预定义的代码集。 感谢建议,现在我可以这样做了:

<xsl:value-of select="sum(item[code=1.1 or code=1.2 or 
code=1.3.1 or code=1.3.2]/amt)"/>

但我想创建一个模板并使用易于阅读的参数调用它以列出所有需要的代码。类似于:

... <xsl:with-param name="set" select="'1.1, 1.2'"/> ...
or
... <xsl:with-param name="set" select="'(1.1)|(1.2)'"/> ...

然后在调用的模板中执行如下操作:

<xsl:value-of select="sum(item[code in $set]/amt)"/>

在 XSLT 中是否可行?

P.S。我正在使用非常受限的 SAP XSLT 处理器,例如它没有 matches()。

<xsl:variable name="set"
    select="'(1.1)(1.2)(2.1)'"/>

<xsl:template match="/">
    <answer>
        <xsl:call-template name="sum-it">
            <xsl:with-param name="set" select="$set"/>
            <xsl:with-param name="items" select="lines/item"/>
        </xsl:call-template>
    </answer>
</xsl:template>

<xsl:template name="sum-it">
    <xsl:param name="set"/>
    <xsl:param name="items"/>

    <xsl:value-of select="sum(
        $items[contains($set,concat('(', code ,')'))]/amt)"/>

</xsl:template>