[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Comparing node for identity using union

Subject: RE: [xsl] Comparing node for identity using union
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Wed, 19 Jan 2005 16:12:56 -0000

> > The $pos is defined like
> >
> > 	<xsl:param name="pos" select="0"/>
> That's certainly a number, and since positions start at 1,
> xyz[$pos] should always be an empty sequence (node-set). If,
> as you say, one processor is behaving differently from all
> the others, then that's prima facie evidence of a bug.

I think it's only a number as long as it doesn't get overridden - as
soon as you pass in the value a parameter it becomes a string.  For
example this XML:


And this stylesheet:

<xsl:stylesheet version="1.0"

<xsl:param name="pos" select="5"/>

<xsl:template match="/">
  <xsl:apply-templates select="(//menu)[$pos]"/>


Transformed without specifying a parameter produces the result:


Pass in the parameter 'pos' a value of '5' and the result is:


This is consistent across processors.

In XSLT 1.0 the number() function ensures $pos is treated as a number,
2.0 the 'as' attribute on the param does the job.


Current Thread