我不是程式員,需要專業人士的幫助。如果我有多個驗證,我想檢查例如 test = 78 或 81 時我想要這個結果。
我試過使用沒有成功
<xsl:variable name = "vatTerm">
<xsl:choose>
<xsl:when test="(DocumentXML/ApplicationObject/Object/CarTypeId!='78') and (CarTypeId!='81')">
<xsl:value-of select="(($netterm $termfee)*$vatrate ) $eptermfeetotalvat"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select ="$eptermfeetotalvat"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
也試過了;
<xsl:choose>
<xsl:when test="(DocumentXML/ApplicationObject/Object/CarTypeId!=78">
<xsl:value-of select="(($netterm $termfee)*$vatrate ) $eptermfeetotalvat"/>
</xsl:when>
<xsl:when test="(DocumentXML/ApplicationObject/Object/CarTypeId!=81">
<xsl:value-of select="(($netterm $termfee)*$vatrate ) $eptermfeetotalvat"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select ="$eptermfeetotalvat"/></xsl:otherwise>
</xsl:choose>
uj5u.com熱心網友回復:
你猜對了DeMorgan。
但是您忘記了路徑的基礎沒有重復。所以,我想,你應該試試
<xsl:when test="DocumentXML/ApplicationObject/Object/CarTypeId!='78' and DocumentXML/ApplicationObject/Object/CarTypeId!='81'">
<xsl:value-of select="(($netterm $termfee)*$vatrate ) $eptermfeetotalvat"/>
</xsl:when>
這種方法的限制是它檢查給定路徑中是??否有任何 CarTypeId不等于 78 或 81。如果您只有一個CarTypeId,這將適用于 XPath-1.0。
使用 XPath-2.0,您可以簡化和精確這項任務。
uj5u.com熱心網友回復:
我會使用這樣的一個謂詞
<xsl:choose>
<xsl:when test="DocumentXML/ApplicationObject/Object/CarTypeId[.!='78' and .!='81']">
<xsl:value-of select="(($netterm $termfee)*$vatrate ) $eptermfeetotalvat"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select ="$eptermfeetotalvat"/>
</xsl:otherwise>
</xsl:choose>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/507260.html
上一篇:使用模式屬性根據名稱串列驗證值
