XSL:大于和小于?

时间:2019-07-23 07:31:04

标签: xslt

我正在尝试创建各种选项,这些选项取决于我设置的变量的值。下面的代码按预期工作:

<xsl:choose>
     <xsl:when test="$weight &lt; 30">
        <carrier_grid_1>DHL</carrier_grid_1>
            <shipping_time_carrier_grid_1>1</shipping_time_carrier_grid_1>
    </xsl:when>
    <xsl:when test="$weight &gt; 60">
        <carrier_grid_3>Pallet Network</carrier_grid_3>
            <shipping_time_carrier_grid_3>1</shipping_time_carrier_grid_3>
    </xsl:when>
</xsl:choose>

但是,当我尝试执行类似操作时,它会失败并且无法运行:

<xsl:choose>
    <xsl:when test="$weight &gt; 30 and &lt; 60">
        <carrier_grid_2>DX or TNT</carrier_grid_2>
        <shipping_time_carrier_grid_2>1</shipping_time_carrier_grid_2>
    </xsl:when>
</xsl:choose>

我尝试过在线查找,但找不到任何帮助。非常感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

以下更改

<xsl:when test="$weight &gt; 30 and $weight &lt; 60">