简体   繁体   English

如何改变<xsl:variable>价值</xsl:variable>

[英]How to change <xsl:variable> value

I can't get this to work... I simply want to change the value of a globally defined variable:我无法让它工作......我只是想更改全局定义变量的值:

                    <xsl:variable name="isBusiness"></xsl:variable>
                    <xsl:choose>
                        <xsl:when test="yes this is a business">
                               <xsl:variable name="isBusiness">true</xsl:variable>                        
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:variable name="isBusiness">false</xsl:variable>
                        </xsl:otherwise>
                    </xsl:choose>    

Obviously the code is invalid because is already defined, but how would I change the value?显然代码是无效的,因为已经定义了,但是我将如何更改该值?

Check this link out:检查此链接:

http://www.dpawson.co.uk/xsl/sect2/N8090.html#d10874e187 http://www.dpawson.co.uk/xsl/sect2/N8090.html#d10874e187

Basically, your code should look like this:基本上,您的代码应如下所示:

<xsl:variable name="x">
   <xsl:choose>
     <xsl:when test="a">z</xsl:when>
     <xsl:when test="b">zz</xsl:when>
     <xsl:otherwise>zzz</xsl:otherwise>
   </xsl:choose>
 </xsl:variable>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM