Subject: Re: [xsl] Confused with templates and XPath From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 8 Jan 2004 12:27:22 GMT |
> are you sure of that ? yes:-) If I run saxon on the example document that you posted, I get: $ saxon prio.xml prio.xsl Recoverable error Ambiguous rule match for /doc[1]/chapter[1]/para[1] Matches both "//para" on line 8 of file:/c:/tmp/prio.xsl and "chapter/para" on line 5 of file:/c:/tmp/prio.xsl default-para : para1 default-para : para2 Or if you prefer: $ saxon -w2 prio.xml prio.xsl Recoverable error Ambiguous rule match for /doc[1]/chapter[1]/para[1] Matches both "//para" on line 8 of file:/c:/tmp/prio.xsl and "chapter/para" on line 5 of file:/c:/tmp/prio.xsl Processing terminated because error recovery is disabled Error Ambiguous rule match for /doc[1]/chapter[1]/para[1] Matches both "//para" on line 8 of file:/c:/tmp/prio.xsl and "chapter/para" on line 5 of file:/c:/tmp/prio.xsl Transformation failed: Run-time errors were reported > From my point of view, > chapter/para is more specific, so its priority is 0.5 > and //para is less specific, so its priority is negative. _You_ can tell that chapter/para is more specific than //para but the XSLT default priorities were explictly designed _not_ to require the system to do detailed analysis on the paths to determine specificity. 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 David -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Confused with templates a, Frédéric Laurent | Thread | RE: [xsl] Confused with templates a, Andrew Welch |
Re: [xsl] Confused with templates a, Frédéric Laurent | Date | [xsl] XSLT Programmers Reference, Kaarle Kaila |
Month |