xsl-list
[Top] [All Lists]

Re: Confused with templates and XPath

2004-01-08 06:07:28


David Carlisle wrote:
are you sure of that ?

yes:-)

I had no doubt on that :D



If I run saxon on the example document that you posted, I get:

well neither Xalan nor xsltproc complains :(
Same results for both... (even with the permutation)

$ saxon prio.xml prio.xsl
Recoverable error
Ambiguous rule match for /doc[1]/chapter[1]/para[1]
...

the rules are _very_ simple.

If it is a sigle name, such as "para" then it is priority 0
if it is a child or attribute axis followed by a single name
child::para, attribute::para, @para it would also be 0

If its a namespace wildcard such as x:* it's -0.25

If its a node test such as comment() it's 0.25

otherwise it is 0.5

so:

//para has priority 0.5
chapter/para has priority 0.5
para has priority 0

If you set the verbose mode to xsltproc, you have

$ xsltproc -v s05b.xsl xml05.xml
Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform
xsltPrecomputeStylesheet: removing ignorable blank node
xsltParseStylesheetProcess : found stylesheet
xsltCompilePattern : parsing '//para'
xsltCompilePattern : parsed //para, default priority 0.000000
added pattern : '//para' priority 0.000000
xsltCompilePattern : parsing 'chapter/para'
xsltCompilePattern : parsed chapter/para, default priority 0.500000
added pattern : 'chapter/para' priority 0.500000
parsed 2 templates



added pattern : '//para' priority 0.000000
added pattern : 'chapter/para' priority 0.500000

hummm... Then this is a bug ?

cheers

Fred

-- 

XPath free testing software :  http://lantern.sourceforge.net
Frédéric Laurent                     http://www.opikanoba.org

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>