xsl-list
[Top] [All Lists]

RE: Comparing node for identity using union

2005-01-19 09:12:56

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:

<group>
        <menu>1</menu>
        <menu>2</menu>
        <menu>3</menu>
        <menu>4</menu>
        <menu>5</menu>
        <menu>6</menu>                                  
</group>

And this stylesheet:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

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

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

</xsl:stylesheet>

Transformed without specifying a parameter produces the result:

5

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

123456

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.

cheers
andrew





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--