【问题标题】:Testing for 2 conditions under group-starting-with in <xsl:for-each-group>在 <xsl:for-each-group> 中的 group-starting-with 下测试 2 个条件
【发布时间】:2012-07-01 07:16:25
【问题描述】:

我需要在一个 for-each-group 中测试 2 个可能的标签中的 1 个。这可能吗?正确的语法是什么?

我试过“||”但从解析器得到一个错误。我在 Oxygen 12.1 中使用 Saxon PE 9.3。

例如

<xsl:param name="elements" as="element()*"/>    
<xsl:for-each-group select="$elements"
                group-starting-with="condition or condition" >
    <xsl:for-each-group>

【问题讨论】:

    标签: xslt xslt-2.0 xslt-grouping


    【解决方案1】:

    如果您想从两个元素名称中的任何一个开始分组,请尝试

    <xsl:for-each-group select="$elements"
                group-starting-with="foo | bar">
    

    【讨论】:

    • 我认为这就是您要问的,但如果您实际上是在询问使用布尔条件,请使用 group-starting-with="node()[condition1 or condition2]"
    • 不,这正是我所需要的。我实际上刚刚在这个线程中找到了答案。 stackoverflow.com/questions/2219127/…感谢您的帮助!
    猜你喜欢
    • 2012-10-22
    • 1970-01-01
    • 2019-07-23
    • 2012-07-20
    • 2015-03-17
    • 2012-07-17
    • 2015-08-26
    • 1970-01-01
    • 2018-03-29
    相关资源
    最近更新 更多