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

RE: include error

Subject: RE: include error
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Thu, 29 Nov 2007 10:29:59 -0600
RE:  include error
Torsten,

It doesn't quite make sense why you're including a template in another
stylesheet that should override a template you've defined in the current
stylesheet... but such is the nature of the beast when it comes to XSLT
used in the wild. (group environments and such)

If you know that the template in the included stylesheet should always
override the template in any stylesheet that includes it, you can always
explicitly set the template's priority attribute, and that would fix the
duplicate-match error. It won't work if the stylesheet is imported, as
it will have a lower import precedence, which is always more important
than template priority. But it should work fine when the stylesheet is
included.

10 or so should be the most you should ever ideally use for the priority
value, to avoid a priority-race between stylesheets, resulting in
ridiculously large numbers in the long run. Like z-index: 2147483647 in
CSS... it sounds silly, but I've seen it before.

~ Scott

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Thursday, November 29, 2007 6:44 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  include error

> ...this is exactely what I don't need: The imported templates
> have to override the importing as they are more specialized
> as the ones. Shall I just turn arround the mechanism and
> import the general stylesheet into the more specialized?

Yes, absolutely. You should always import a general-purpose module from
a
special-purpose module, never the other way around.
>
> Besides this, for curiosity:
> You state that "[i]t may well cause errors due to the
> presence of duplicate declarations; in fact, if the
> stylesheets contains definitions of global variables or named
> templates, and is included more than once at the same
> precedence, such errors are almost inevitable." (XSLT 2.0,
> 3rd ed., p. 330)
>
> - What does "may" mean?

This is in relation to including the same module more than once.

I think the "may" is correct: There are cases where this won't throw an
error, for example, if the modules are empty, or if they contain
template
rules (match templates) that are never matched. But I wouldn't defend
the
"almost".

Michael Kay
http://www.saxonica.com/

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.