- From: Abel Braaksma <abel.braaksma@xs4all.nl>
- Date: Fri, 7 Oct 2016 01:04:47 +0200
- To: "Public XSLWG" <public-xsl-wg@w3.org>
In many places in the spec we mention or hint that a processor is not required to evaluate an unused variable. How does this work for static parameters and variables? Do we require them to be processed? I browsed through the use-when and shadow attribute sections but couldn't readily find this. This may be important, for instance to detect static errors resulting from the dynamic evaluation of static expressions. Example: <xsl:variable name="x" use-when="1 div 0 eq 0" /> A processor may statically know that this variable is never used. Is it allowed to forego the error and process the stylesheet regardless? I'm inclined to say no, and that static expressions (use-when, static variables/parameters, shadow attributes) must *always* be evaluated. This follows from the notion of compile-time errors in other languages, of which static expressions are an extension. Other example: <xsl:mode name="m" _streamable="doc('settings.xml')/*/@streamable" /> It is possible that the document settings.xml contains an invalid setting for the streamable attribute. However, if a processor can statically infer that mode "m" is never used (it should be able to do so), then does it have to load settings.xml and process it? Again, I'm inclined to say yes: static errors must always be reported. It gets fuzzier with static variables/parameters, since we already say about variables that they only need to be evaluated when they are actually used: <xsl:variable name="foo" static="yes" select="xs:error('oh oh')"/> If no other static, or dynamic expression uses $foo, can it be ignored? Even here, I'd say: no, static expressions can never be ignored and should therefore be crafted more carefully than dynamic expressions. Note: no bug raised, I am not sure there's something wrong here. Cheers, Abel
Received on Thursday, 6 October 2016 23:05:25 UTC