W3C home > Mailing lists > Public > xsl-editors@w3.org > October to December 2002

RE: VariableReferences in patterns in XSLT 1.0

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Fri, 25 Oct 2002 19:55:50 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DCEA@daemsg02.software-ag.de>
To: zongaro@ca.ibm.com, xsl-editors@w3.org

>      In my previous note, I didn't represent another 
> interpretation of the 
> text in XSLT 1.0 that has come up a number of times.  That 
> interpretation 
> holds the definition of Pattern in section 5.2 [4] to be in 
> conflict with 
> sections 5.3 [1] and 12.2 [2]. 
> 
>      Section 5.2 takes great pains to define the grammar for 
> Pattern very 
> precisely, and states explicitly that "Predicates in a 
> pattern can use 
> arbitrary expressions."  A VariableReference in an XPath 
> expression can 
> appear in places other than a predicate, but the grammar defined for 
> Pattern eliminates such uses.

I think there are quite a few examples of such apparent conflicts in the
spec, and probably in all specs. You have to apply the legal principle that
the more specific rule takes precedence over the more general rule. A rule
affecting some contexts in which patterns are used is more specific than a
rule for patterns in general; and a rule that allows "arbitrary expressions"
is more general than one that disallows variable references. In particular,
it's absolutely normal practice for syntax rules to allow things that the
semantic rules then disallow under particular circumstances.

Michael Kay


> 
>      Thus, the text in 5.3 and in 12.2 can be read as having 
> been intended 
> as a reaffirmation of the rules in 5.2, rather than an additional 
> constraint - except that those rules don't eliminate the use of 
> VariablesReferences in predicates, as the quotation above 
> confirms. Hence, 
> the view that 5.3 and 12.2 actually conflict with the grammar 
> for Pattern 
> in 5.2 and with the quoted sentence.  A new grammar that 
> defines and uses 
> a PredicateWithoutVariables non-terminal would be needed to 
> resolve the 
> conflict if that was the intention of the Working Group.
> 
> [1] http://www.w3.org/TR/xslt#section-Defining-Template-Rules
> [2] http://www.w3.org/TR/xslt#key
> [3] http://www.w3.org/TR/xslt#number
> [4] http://www.w3.org/TR/xslt#patterns
> ------------------------------------------------------------------
> Henry Zongaro      Xalan development
> IBM SWS Toronto Lab   Tie Line 969-6044;  Phone (905) 413-6044
> mailto:zongaro@ca.ibm.com
> 
> 
Received on Friday, 25 October 2002 13:56:33 GMT

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