Re: Qualified variable names
Wondering if qualifying variable names in XSLT 2.0 is a good idea as in:
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 customers' customers.
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@xxxxxxxxxxxxxxxxxxxx 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
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