Positional predicates in pattern matching

Subject: Positional predicates in pattern matching
From: Kevin Jones <kjones@xxxxxxxxxxx>
Date: Fri, 2 Jul 2004 16:34:35 +0100
I have seen some behaviour in Saxon 6.5.2 and Xalan that I can't really 
explain by reading the standard. I have probably just missed something but 
would appreciate some second opinions.

If you execute,

   <xsl:template match="/">
        <xsl:variable name="foo" select="a/b[position()>1]"/>
            <xsl:apply-templates select="$foo" mode="one"/>
            <xsl:apply-templates select="$foo" mode="two"/>

    <xsl:template match="b[1]" mode="one">P1</xsl:template>
    <xsl:template match="b[2]" mode="one">P2</xsl:template>
    <xsl:template match="b[3]" mode="one">P3</xsl:template>

    <xsl:template match="b[true()][1]" mode="two">R1</xsl:template>
    <xsl:template match="b[true()][2]" mode="two">R2</xsl:template>
    <xsl:template match="b[true()][3]" mode="two">R3</xsl:template>



The result is P2P3R2R3. I was expecting either P2P3R1R2 or perhaps even 
P2P3R1R1. It is obvious why you get P2P3 but that is only true for the first 
predicate of a StepPattern. In the second set of templates I would expect the 
positions should be 1 & 2 or perhaps even just 1 twice since pattern matching 
is defined as being a processes applied to individual nodes.


Current Thread