我的XSL是像XSL conditon檢查中應用模板
<root>
<tests>
<test id="222">
<actionId>233</actionId>
</test>
<test id="22">
<actionId>23333</actionId>
</test>
</tests>
<confs>
<conf id="2211"></conf>
</confs>
</root>
<xsl:key name="confId"
match="confs/conf"
use="@id"/
<xsl:template match="main">
Test:
<xsl:apply-templates select="tests/test" />
</xsl:template>
<xsl:template match="tests/test">
<xsl:choose>
<xsl:when test="actionId[.='']">
<li>
<xsl:choose>
<xsl:when test="key('confId', @id)">
Used </xsl:when>
<xsl:otherwise> Not found</xsl:otherwise>
</xsl:choose>
</li>
</xsl:when>
<xsl:otherwise> <li>Not at all found</li></xsl:otherwise>
</xsl:choose>
</xsl:template>
現在
權「並非在所有發現的」打印信息在每次迭代此模板匹配的actionId不爲空,這是我需要打印只有一次,如果不執行條件。
期望輸出是
我說:你執行前檢查條件模板並在那裏打印。 – riffnl 2012-04-20 10:35:57
但我迭代節點檢查測試模板中的條件 – Unni 2012-04-20 10:50:27
不完整的代碼和缺乏任何源XML - 你認爲人們能夠理解你所問的任何東西嗎?如果提供完整的代碼和源XML文檔,則可以解釋觀察到的行爲的原因。我們需要查看密鑰的定義以及如何選擇模板來執行。請編輯問題並提供缺少的信息。 – 2012-04-20 12:55:18