This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29226 - [xt30] Empty enclosed expressions
Summary: [xt30] Empty enclosed expressions
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-22 10:41 UTC by Michael Kay
Modified: 2015-11-05 21:25 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2015-10-22 10:41:06 UTC
XQuery has adopted a proposal to allow empty enclosed expressions, e.g.

<a b="some { (:absent:) } content"/>

Should we do the same?

We don't define value templates using a grammar, so the change required would be in 5.6:

Change:

A variable part consists of an XPath expression enclosed in curly brackets ({}). 

to

A variable part consists of an optional XPath expression enclosed in curly brackets ({}). 

Change:

It is a static error if the string contained between matching curly brackets in a value template does not match the XPath production ExprXP30

to

It is a static error if the string contained between matching curly brackets in a value template does not match the XPath production ExprXP30? (that is, an expression or nothing)

Change:

The expansion of a variable part is obtained by evaluating the enclosed XPath expression and converting the resulting value to a string

to

The expansion of a variable part is obtained as follows:

* If the variable part contains an expression, [current text]

* Otherwise, the result is a zero-length string.
Comment 1 Abel Braaksma 2015-10-22 19:24:53 UTC
I assume you mean to allow this for dynamic AVT's, static AVT's and TVT's?

I think it is a good thing. If I want to temporarily disable an expression, I have to wrap it now into smiley comments and add a "()" (empty sequence) expression to it, which is annoying (but by no means unsurpassable).
Comment 2 Abel Braaksma 2015-10-22 19:29:12 UTC
> It is a static error if the string contained between matching curly brackets 
> in a value template does not match the XPath production ExprXP30? (that is, 
> an expression or nothing)

We may need to be explicit about whitespace; "nothing" is too broad (or narrow). For XPath whitespace is clearly defined, but we now say "optional XPath expression", so we must be clear about what it is when it is not an XPath expression.
Comment 3 Michael Kay 2015-10-30 12:31:54 UTC
The changes were accepted, and have been applied to the spec (in a way that answers the questions raised in comments on this bug). The bug remains open to allow the WG to review and approve the changes.
Comment 4 Michael Kay 2015-11-05 18:43:41 UTC
The change was approved.