【问题标题】:XSL Two Conditions Expression If TestXSL 两个条件表达式 If Test
【发布时间】:2019-11-19 15:08:46
【问题描述】:

我可以根据需要处理我的 2 个表达式:

<xsl:if test="string-length(.) > 15">
    <xsl:if test="not(contains(., ' '))">
        <xsl:attribute name="font-size">5pt</xsl:attribute>
    </xsl:if>
</xsl:if>

但是我不清楚为什么我不能把它写成一个test

<xsl:if test="string-length(.) > 15 && not(contains(., ' '))">
    <xsl:attribute name="font-size">5pt</xsl:attribute>
</xsl:if>

这会引发我的处理器 (Apache XSL FO) 的未知错误。

我正在尝试测试我所在的当前节点,看看它是否包含超过 15 个字符且没有空格。如果满足该匹配,我将字体大小减小到5pt

【问题讨论】:

    标签: xslt xslt-2.0 xsl-fo


    【解决方案1】:

    XSLT 中使用的表达式语言是 XPath,在 XSLT 2.0 中是 XPath 2.0。布尔值and 运算符只有英文名称,所以您只需要string-length(.) &gt; 15 and not(contains(., ' '))

    【讨论】:

    猜你喜欢
    • 2011-11-06
    • 1970-01-01
    • 1970-01-01
    • 2016-08-23
    • 1970-01-01
    • 2023-02-13
    • 2012-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多