Re: Discrepancy in handling current() in a pattern

 Subject: Re: Discrepancy in handling current() in a pattern From: Alain Date: Thu, 11 Jun 2009 08:27:09 +0200
```Hi Ken,

- Thanks for the pointers to the norms, it's very helpful !
Scilly me I was searching for current() as current is a common word and give too many matches.

So
-1) I.E. is right
Firefox and Xalan are being too laxist (but it's quite clear what current() means in this context)

-3) Allas, if current() is not allowed, either I make the tests not generic (for example assuming you have a 9x9 sudoku) either I see no solution than to revert to the ugly case/otherwise

-2)

><!-- First "stack" of matching for vertical lines -->
><!-- This matches cells that have a vertical lines on their left -->
>
><xsl:template match="cell[@x != '1' and @z != ../cell[@y =
>current()/@y][@x= current()/@x - 1]/@z]" mode="cell" priority="2">
>...
><!-- This matches cells that have a horizontal lines on their top -->
>
><xsl:template match="cell[@y!='1' and @z != ../cell[@y = current()/@y
>-1][@x= current()/@x]/@z]" mode="cell-2" priority="2">

>If you are at the top left cell, then won't both of the above
>template rules match the cell you are at?  That would be ambiguous
>and Saxon is right to report an ambiguous template rule match.

Definitely no.
I admit the logic is quite complex because it is "optimised".
The 4 tests are not consecutive but arranged 2 by 2 so that :
- the condition to test on each match is less complex (faster)
- you have the result with 2 tests where you could have to run 4 tests on a consecutive model.
The cells that have both borders would match both templates but in a "successive" way as these templates are not in the same "mode".
So those cells match only one template at a time.

But *I withdraw the question about Saxon* as it appears to be a bug of an older version of Saxon (I'll give the exact reference later).

I just tried again on my Linux box with Saxon 9.1.0.2 and it gives absolutely no warning, all works fine.

Many thanks.

```

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!