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 29229 - [xslt30] Streamability of XPath 3.1 constructs
Summary: [xslt30] Streamability of XPath 3.1 constructs
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
Depends on:
Reported: 2015-10-22 15:44 UTC by Michael Kay
Modified: 2015-10-30 15:38 UTC (History)
0 users

See Also:


Description Michael Kay 2015-10-22 15:44:01 UTC
We need to add streamability rules XPath 3.1 constructs. A first cut at these rules appears in

and the editor was actioned to refine the proposal. Here is the refinement.

Add to section 4.7 (Data Model for Streaming)

Two new data structures have been added to the data model: maps and arrays. Both are defined in XPath 3.1, but maps are also available in XSLT processors that only support XPath 3.0.

Streaming facilities in this specification are, for the most part, relevant only to streamed processing of XML trees, and not to other structures such as sequences, maps and arrays, which will typically be held in memory unless the processor is capable of avoiding this.

The rules for creating maps and arrays are designed to ensure that the entries in a map, and the members of an array, cannot contain nodes from a streamed document. This is achieved by the way in which the streamability properties of the relevant expressions and functions are defined.

By contrast, sequences can and often do contain nodes from streamed documents, and a major purpose of the rules for streamability is to make this possible.

19.2 Determining the Static Type

In the list introduced by “The mapping is as follows”, change “

	• FunctionTest and MapTest map to U{function(*)}
	• FunctionTest, MapTest and ArrayTest map to U{function(*)}

We have already added new XPath 3.1 constructs as an additional table towards the end of the section, but this needs slight amendment because the Arrow expression is now a first-class expression in its own right rather than a type of PostfixExpr. Furthermore, lookup expressions are now supported in XSLT 3.0 whether or not the XPath 3.1 feature is enabled, so these should move into the main table.

19.8.8 Classifying Expressions

The table of expressions needs the same additions as in 19.2: Unary lookup, Postfix lookup, arrow expressions, square and curly array constructors.

For square and curly array constructors, the GSR applies with operand usage navigation for all the operands, which can be expressed using the proformas [N, N, …] and {N, N, …}.

For an arrow expression X => F(X, Y) the streamability is the same as that of the equivalent static or dynamic function call F(X, Y, Z).

For a postfix lookup, the GSR applies. Given E?L, E has usage inspection (by analogy with dynamic function calls), and L is a higher-order operand with usage absorption. Where L is a wildcard (E?*), there is only one operand E, with usage inspection.

For a unary lookup, ?L has the same streamability as the postfix lookup expression .?L. 

19.8.9 Classifying calls to built-in functions

New 3.1 functions need to be added to the list. They are all be straightforwardly definable using the “proforma” technique. The list here is generated from the function catalog used when generating the XPath 3.0, XPath 3.1, and XSLT 3.0 specifications. The XPath 3.0 and XSLT 3.0 catalogs have been annotated with operand usages. The XP30 usages need to be transferred to the XP31 spec, and usages added for functions that are new in XP31.

For the array functions, the appropriate proformas are:

array:get(A, A)
array:append(A, N)
array:subarray(A, A, A)
array:remove(A, A)
array:insert-before(A, A, N)
array:for-each(N, I) (map:for-each should also be (N, I))
array:filter(N, I)
array:fold-left(N, A, I)
array:fold-right(N, A, I)
array:for-each-pair(N, N, I)
array:sort(N, I)

The other new functions in 3.1 are:

sort(N, I)
load-xquery-module(A, A)
transform(A, A)
contains-token(A, A)
Comment 1 Michael Kay 2015-10-29 17:54:39 UTC
In looking at the list for built-in functions, it was noted that for array/map functions, an argument that has to be a map/array can have usage I, since this can never cause a streamability problem.
Comment 2 Michael Kay 2015-10-29 17:55:16 UTC
Decided to accept the proposal with the above change.