Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Qualified variable names

From: "G. Ken Holman" <gkholman@-------------------->
To:
Date: 11/3/2008 5:28:00 PM
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:



<xsl:variable name="a:x">...</xsl:variable>



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 
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent