我是第一次接触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发布于 2012-06-11 15:56:00
我看不到任何明显的原因:这可能意味着解释存在于代码中您没有向我们展示的部分。您能否发布一个完整的工作示例来演示该问题,最好不要使用msxsl:node-set()?
https://stackoverflow.com/questions/10975256
复制相似问题