At 2008-11-03 09:18 -0800, JamesXslt Smith wrote:
Wondering if qualifying variable names in XSLT 2.0 is a good idea as in:
where the prefix a is bound to a namespace URI.
This was also available in XSLT 1.0 and I use it *extensively*
because for many of my customers I deliver a black-box stylesheet
core that is built upon by other project team members or my
I often have two namespaces for each library: a public one
(declaring global constructs users of the black box are allowed to
override) and a private one (declaring global constructs users of the
black box are not allowed to override).
Consider your example: if I didn't qualify the variable "x" in my
black box, and a user just coincidentally happened to declare their
own "x", then my code could easily go crazy.
I explicitly counsel my XSLT students about the importance of this.
Qualifying all global names (including modes, keys, templates,
variables, etc) is one of the enforced stylesheet writing rules when
using the XSLStyle XSLT documentation methodology.
It has also come in handy when obfuscating stylesheets.
I think it is one of the most important features of XSLT that has
been available since 1999.
I hope this helps.
. . . . . . . . . . Ken
Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
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>