Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 如何在XSL中修改变量的值?_Xml_Xslt - Fatal编程技术网

Xml 如何在XSL中修改变量的值?

Xml 如何在XSL中修改变量的值?,xml,xslt,Xml,Xslt,我有一个xsl文件,它获取数据并存储在变量中。我有一个值1存储在变量中。现在我想修改变量值,即如果它包含1,则应替换为激活。我怎么做 提前谢谢 一旦设置了变量的值,就不能更改或修改该值 价值 假设你有: <xsl:variable name="var">1</xsl:variable> 或者您可以声明新变量: <xsl:variable name="var2"> <xsl:choose> <xsl:when tes

我有一个xsl文件,它获取数据并存储在变量中。我有一个值1存储在变量中。现在我想修改变量值,即如果它包含1,则应替换为激活。我怎么做

提前谢谢

一旦设置了变量的值,就不能更改或修改该值 价值

假设你有:

<xsl:variable name="var">1</xsl:variable>
或者您可以声明新变量:

<xsl:variable name="var2">
    <xsl:choose>
        <xsl:when test="$var=1">activated</xsl:when>
        <xsl:otherwise><xsl:value-of select="$var"/></xsl:otherwise>
    </xsl:choose>
</xsl:variable>

激活
在这种情况下,必须使用指令在输出中打印:

<xsl:value-of select="$var2" />


谢谢卢卡斯。那么我怎样才能得到我想要的输出呢?Lukasz,在第二行中,activated存储在$var中?bcoz我将$var作为html输出,或者我可以直接输出它。
<xsl:value-of select="$var2" />