xsl-list
[Top] [All Lists]

Re: [xsl] Discrepancy in handling current() in a pattern

2009-06-11 02:27:45
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[(_at_)x != '1' and @z != ../cell[(_at_)y =
current()/@y][(_at_)x= current()/@x - 1]/@z]" mode="cell" priority="2">
...
<!-- This matches cells that have a horizontal lines on their top -->

<xsl:template match="cell[(_at_)y!='1' and @z != ../cell[(_at_)y = current()/@y
-1][(_at_)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.



--~------------------------------------------------------------------
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>
--~--