[xsl] insight into string vs number comparisons?

Subject: [xsl] insight into string vs number comparisons?
From: Steve <subsume@xxxxxxxxx>
Date: Wed, 14 Nov 2007 11:35:01 -0500
I've just encountered a very strange problem, illustrated below.

Source XML
<Records>
  <Record>
     <id>1</id>
   </Record>
  <Record>
    <id>2</id>
  </Record>
</Records>

XSL:

<xsl:variable name="id" select="'2'" />

<xsl:for-each select="/Records/Record">
	[<xsl:value-of select="id=$id" /> (<xsl:value-of select="id"
/>|<xsl:value-of select="$id" />)]
</xsl:for-each>
<xsl:for-each select="/Records/Record">
        [<xsl:value-of select="id=number($id)" /> (<xsl:value-of
select="id" />|<xsl:value-of select="$id" />)]
</xsl:for-each>
Output:

[true (279|279)]  [true (301|279)]         <!-- ?!?!!?! -->
[true (279|279)]  [false (301|279)]       <!-- this is what i'd expect -->

What's going on?

Current Thread