W3C home > Mailing lists > Public > xsl-editors@w3.org > July to September 1999

Re: Recursion among top-level elements

From: James Clark <jjc@jclark.com>
Date: Tue, 03 Aug 1999 21:39:47 +0700
Message-ID: <37A6FF33.DB56E26E@jclark.com>
To: Kay Michael <Michael.Kay@icl.com>
CC: "'xsl-editors@w3.org'" <xsl-editors@w3.org>
The problem here seems to me to be that the spec doesn't make clear
exactly when a template is considered to "reference a global variable".
In particular, if you do an xsl:apply-templates and a pattern in a
template rule includes a global variable reference, have you thereby
referenced that variable?  There are several possible answers:

1. yes, always
2. only if the pattern matches ignoring qualifiers
3. only if the pattern matches ignoring qualifiers and ancestry

Disallowing global variable definitions from calling xsl:apply-templates
would be another possibility as you mention.

Similarly if a key definition references a global variable, and you call
a key function, have you thereby referenced that global variable?  Again
there are several possible answers,

1. yes always
2. yes if the name matches
3. yes if the name matches and the pattern matches ignoring qualifiers
etc.

Certainly, the spec needs to say something here, I don't see any need to
limit the current freedom to define things in any order.

Kay Michael wrote:
> 
> The XSLT specification (section 12.4) discusses the possibility of cycles
> existing among global variable declarations, but it does not seem to deal
> with other possibilities for circular definitions.
> 
> Example1: there is nothing to stop a global variable definition calling
> xsl:apply-templates; and there is nothing to stop the match pattern in
> xsl:template referencing a global variable. In general therefore, when
> xsl:apply-templates is called within a global variable definition it will be
> impossible to determine which template to invoke.
> 
> Example2: there is nothing to stop a global variable definition referencing
> a key, and there is nothing to stop any of the patterns in a key definition
> from referencing a global variable.
> 
> I don't think it will be possible to fix these problems without some fairly
> severe limiting of the current freedom to define things in any order.
> 
> Many of the problems could be solved by a ban on forwards references, e.g. a
> global variable definition can only refer to a global variable, named
> template, attribute set, or key that has been previously declared in the
> stylesheet.
> 
> The problem with xsl:apply-templates remains: I think it is necessary either
> to stop template match patterns referring to global variables, or to stop
> global variable definitions invoking xsl:apply-templates.
> 
> Mike Kay
Received on Tuesday, 3 August 1999 10:42:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:49 GMT