Xml 的不正确结果

Xml 的不正确结果,xml,xslt,xerces,Xml,Xslt,Xerces,我正在使用xerces使用两个xsl文件处理xml,并在xsl:for each循环中得到错误的结果, for循环返回8个结果,而不是4个结果 如何调试此错误? 谢谢你的帮助 xml: <Updates> <update_record displayTimestamp="2013-03-08 11:44:00"> <user>MNM3322</user> </update_record> <update_rec

我正在使用xerces使用两个xsl文件处理xml,并在xsl:for each循环中得到错误的结果,
for循环返回8个结果,而不是4个结果
如何调试此错误?
谢谢你的帮助

xml:

<Updates>
  <update_record displayTimestamp="2013-03-08 11:44:00">
    <user>MNM3322</user>
  </update_record>
  <update_record displayTimestamp="2013-03-08 11:45:00">
    <user>MNM3323</user>
  </update_record>
  <update_record displayTimestamp="2013-03-08 11:46:00">
    <user>MNM3322</user>
  </update_record>
  <update_record displayTimestamp="2013-03-08 11:47:00">
    <user>MNM3325</user>
  </update_record>
  <LatestUpdate/>
</Updates>

MNM3322
MNM3323
MNM3322
MNM3325
first.xsl

<xsl:variable name="updates" select="//Updates"/>

second.xsl

<xsl:variable name="updatesCount"
              select="count($updates/update_record)"/>

<xsl:include href="first.xsl"/>

<xsl:value-of select="$updatesCount"/>  this gives correct result (4)
<xsl:for-each select="$updates/update_record"> this gives incorrect output (8 rows instead of 4)
       <xsl:value-of select="position()"/>
</xsl:for-each>

这将给出正确的结果(4)
这会产生不正确的输出(8行而不是4行)

找到了问题。它是沙兰虫

请看这里:
如果在全局变量中使用递归模板,则循环变量/参数引用



谢谢大家!

您的源文档是否有多个
更新
元素?哪里定义了
$updateCount
?只有一个Updates元素-我编辑以包含updateCount上面显示的XSLT是否为每个
输出“12345678”或“12341234”或其他内容?您向我们显示的代码没有问题。要么您没有向我们展示某些东西,要么您误解了输出,要么(不太可能)您的XSLT处理器有问题。是-输出是12345678,XERCES版本是XERCES-J 2.7.1 Xalan java 2.7.0