Skip to main content

Strange behavior of count function

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2010-12-21

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 )"/>

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