[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Preference rules for /something and /*
Abel,
At 04:07 PM 6/18/2007, you wrote: I'm not sure if I get this right, so I'm asking here. If I have the following two rules: Yes. Both of these fall into the "anything else" category. There are three categories: 1. Simple tests by name, on the child or attribute axis in a single step e.g. "root" or "@root" -- priority 0 2. "Wildcard" matches on the child or attribute axis in a single step e.g. "@*" or "comment()" -- priority -0.5 3. Anything else e.g. "//root", "/root", "/*/root" or "/*" -- priority 0.5 (There's also a category between rules 1 and 2: a match on a namespace-and-type, with a single step, such as "html:*" or "svg:node()", gets priority 0.25.) Or should a processor distinguish and select the first as having a higher prio (which intuitively seems more correct)? Early drafts of XSLT attempted to specify such a cascade, but either it proved difficult to specify completely, or it appeared unlikely to work transparently enough, so the rules were simplified. This does mean that you can get edge cases like yours, where matches using wildcards (node tests by type, that is, as opposed to those by name) fall into the "anything else" category by virtue of extra steps in the XPath. Of course I can use priority='x', but I'm curious about the default prio here. Given the rough granularity of the discriminations, it's generally wise to make priorities explicit as soon as there's any reasonable chance for confusion. Cheers, Wendell PS: the same happens when I over-specify the first rule, i.e.: /root[foo[bar='y']] Yes, that's also an "anything else". ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|