このような XML が与えられた場合
<data>
<item temp="cool"/>
<item temp="hot"/>
<item temp="hot"/>
<item temp="lukewarm"/>
</data>
何かがホットかどうかを簡単にテストできます。
<xsl:if test="/data/item/@temp = 'hot'">
Something's hot in here
</xsl:if>
しかし、何もホットでないかどうかをテストするのは少し複雑です。
<xsl:choose>
<xsl:when test="/data/item/@temp = 'hot'"></xsl:when>
<xsl:otherwise>
Nothing's hot in here.
</xsl:otherwise>
</xsl:choose>
not ケースにいくつかの要素を追加したい場合がいくつかあるので、余分なコードを削除したいと思います。
とにかくこれを1つのテストステートメントに書くことができますか?
ところで、これは機能しません
<xsl:if test="/data/item/@temp != 'hot'">
Nothing's hot in here
</xsl:if>
ひとつのものが熱くなければ過ぎてしまうからです。