At 2011-04-14 20:40 +0100, Andrew Welch wrote:
> Remember that mode names can be namespace qualified. When I create XSLT
> stylesheet libraries, I use two namespaces for the name of the
modes engaged
> therein: a public one that my library users are allowed to use (to exploit
> the library), and a private one that my library users are
expressly told not
> to use (so as not to inadvertently interfere with the operation of the
> library).
That's an interesting workaround to the lack of visibility modifiers
for the xslt library designer...
I use the same two-namespace convention for all globally-declared
variables in the library. And keys. And named
templates. *Everything* with a globally-scoped name in the library
is namespace qualified. I don't bother with locally-scoped variables.
Without namespaces, if my imported library makes use of a global
variable named "x", and my user's importing stylesheet inadvertently
declares its own variable named "x", then my library won't work as expected.
Namespaces in libraries avoid execution errors and duplicate
declaration errors.
Very useful. And this approach has been available since day one of
XSLT 1.0 and so has been a long-time practice for me. I first
started using it when contracted to create a library being sent out
of the development team to many remote departments who were going to
have their own developers write importing stylesheets.
. . . . . . . . . . Ken
--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--