Skip to main content

Strange behavior of count function

No replies
frankzimmermann
Offline
Joined: 2010-12-21
Points: 0

Hello,
somehow I found a strange behavior for the count function, which is different with Xalan 2.7.1 but comes up on my Mac and Ubuntu engine.
The following stylesheet
<xsl:template match="/">
<xsl:variable name="subject1" select="//Subject[1]"/>
<xsl:variable name="subjects" select="//Subject[count(.|$subject1) = 1]"/>
<xsl:value-of select="count($subjects)"/>
<xsl:value-of select="count(//Subject[1]| $subject1 ) "/>
<xsl:value-of select="count(//Subject[2]|$subject1 )"/>
</xsl:template>

for the input file
<example>
<Subject/>
<Subject/>
</example>
results in 212 as opposed to the expected 112.
I am using Java 1.6.0.15 on my Mac and 1.6.0.20 on my Linux engine.
Do you have any suggestions how to continue?
best wishes
Frank