【问题标题】:XSL/FO skip a value in Choose statementXSL/FO 在选择语句中跳过一个值
【发布时间】:2021-02-13 02:09:36
【问题描述】:

我正在尝试找出一种方法来跳过我的 XSL 模板中的值。该值位于名为“Editor”的 select="ID" 标记中。我正在尝试跳过选择时语句中的特定值,但我不确定这是否可行。

        <xsl:param name="caption">
            <xsl:choose>
                <xsl:when test="Description"><xsl:value-of select="Description" /></xsl:when>
                <xsl:otherwise><xsl:value-of select="ID" /></xsl:otherwise>
            </xsl:choose>
        </xsl:param>

如何在上述逻辑中获取 xsl 语句以跳过 ID 中名为 Editor 的值?

【问题讨论】:

    标签: xml xslt xslt-1.0 apache-fop


    【解决方案1】:
    <xsl:param name="caption">
        <xsl:choose>
            <xsl:when test="Description"><xsl:value-of select="Description" /></xsl:when>
            <xsl:otherwise><xsl:value-of select="ID[not(. = 'Editor')]" /></xsl:otherwise>
        </xsl:choose>
    </xsl:param>
    

    “任何不等于'Editor'&lt;ID&gt;的值。”

    所以如果只有一个&lt;ID&gt;,这会选择 1 个或 0 个节点。

    【讨论】:

    • 你就是这样做的......非常感谢
    猜你喜欢
    • 2015-02-01
    • 2014-09-16
    • 2011-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-16
    相关资源
    最近更新 更多