![](/img/trans.png)
[英]What is better msxsl:node-set() or exsl:node-set() function?
[英]msxsl:node-set strange behaviour
我是xslt的新手,並且收到以下行為。 嘗試使用具有模式條件的節點集對項目進行計數時,我得到了不同的結果。 結果是否更改取決於我是否將條件值轉換為字符串,如下所示。 某些專家可以幫助解釋導致此行為的原因。
<xsl:for-each ....
//there is two area that why we need the position()=1
<xsl:variable name="checkLocation" select="area[position()=1]" />
方案A-錯誤的結果
<xsl:value-of select="count(msxsl:node-set($allItems)//item[area[position()=1] = $checkLocation])"/> will show 10
方案B-將左側條件轉換為字符串后的正確結果
<xsl:value-of select="count(msxsl:node-set($allItems)//item[string(area[position()=1]) = $checkLocation])"/> will show show 1
我看不到任何明顯的原因:這可能意味着解釋位於您未顯示給我們的代碼部分中。 您是否可以發布一個完整的工作示例來說明問題,而理想情況下無需使用msxsl:node-set()?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.