[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2008-11-03 09:18 -0800, JamesXslt Smith wrote:
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
Re: [xsl] Qualified variable names
Subject: Re: [xsl] Qualified variable names From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 03 Nov 2008 12:27:54 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Qualified variable names, Dimitre Novatchev | Thread | Re: [xsl] Qualified variable names, Florent Georges |
Re: [xsl] Qualified variable names, Colin Paul Adams | Date | Re: [xsl] XPath "//", speed, and Sa, Tony Graham |
Month |
Keywords