Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.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
XSL:IF与xslt1.0中的orcondition实现_Xslt_Xslt 1.0 - Fatal编程技术网

XSL:IF与xslt1.0中的orcondition实现

XSL:IF与xslt1.0中的orcondition实现,xslt,xslt-1.0,Xslt,Xslt 1.0,我有下面的模板,如图所示 <xsl:for-each select="/abc/def"> <xsl:if test=".Id='xxx' and ./Role='yyy' "> <xsl:value-of select=" 'true'"/> </xsl:if> 现在我想把or条件放在xsl中:如果条件1为真,那么结果也应该为真,或者如果条件2为真,那么结果也应该为真,现在请建议如何放置or

我有下面的模板,如图所示

<xsl:for-each select="/abc/def">
    <xsl:if test=".Id='xxx' and ./Role='yyy' "> 
            <xsl:value-of select=" 'true'"/>
        </xsl:if>

现在我想把or条件放在xsl中:如果条件1为真,那么结果也应该为真,或者如果条件2为真,那么结果也应该为真,现在请建议如何放置or条件 我已经想出了这个解决方案,请告知它是否正确

<xsl:if test=".Id='xxx' and ./Role='yyy'  or  test=".Id='ttt' and ./Role='ccc' "> 

每次我不确定优先级时,我都使用括号,例如test=“(Id='xxx'和Role='yyy')或(Id='ttt'和Role='ccc')”。

顺便说一句,“如果”中只有一个“测试”属性,您不需要在第二个条件下重复该属性。

S非常感谢您的建议,不需要在第二个条件下重复,那么我将如何编写其他条件advise@TuntunDfdhflflfff吉尔卡已经在他的回答中告诉你了。仔细看看。