我在XSLT中有一个名为variable_name
的变量,如果产品具有名称为A或B或A和B的属性,则我正在尝试将其设置为1
。
<xsl:variable name="variable_name">
<xsl:for-each select="product/attributes">
<xsl:if test="@attributename='A' or @attributename='B'">
<xsl:value-of select="1"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
是否有办法在if语句中匹配多个字符串,因为我的代码只能匹配A或B是否存在。如果A和B都存在,它不会将变量设置为1。由于我是XSLT的新手,所以希望能得到帮助。