[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Confused with templates and XPath

Subject: Re: Confused with templates and XPath
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 8 Jan 2004 12:27:22 GMT
ambiguous rule match
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.