[Bug 17206] Making dynamic evaluation via xsl:evaluate more dynamic

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17206

--- Comment #3 from Michael Kay <mike@saxonica.com> 2012-09-26 23:43:45 UTC ---
In response to WG discussion, my proposal as editor is that we satisfy this
requirement by removing the xsl:with-param child of xsl:evaluate, and replacing
it with a new optional attribute with-params whose value is an expression; the
expression must evaluate to a map. The map must be of type map(xs:QName,
item()*).

The names present in the map are added to the static context for the target
XPath expression, and the name/value pairs present in the map are added to the
variable values in the dynamic context of the expression.

It was suggested in the email that we allow any function, not only a map.
However, the XPath evaluation model requires variable names to be known
statically (i.e at the time of static analysis of the XPath expression, which
is during dynamic evaluation of the stylesheet...), and this would not be
possible with a general function; we need the ability to enumerate the keys.
(Also, from practical experience, the JAXP XPath interface doesn't allow static
enumeration of the supplied parameters, and it's a pig to implement as a
result)

Unlike the previous xsl:with-param syntax, using a map gives no ability to
declare the types of the values, and therefore to get any of the implicit
conversions that occur with the function conversion rules. However, we're
dealing here with a very dynamic capability, so dynamic typing seems
appropriate. A user who wants to have some type checking and implicit
conversion can write something like:

<xsl:variable name="p1" select="expression" as="xs:integer"/>
<xsl:evaluate xpath="$p1 + 1" with-params="map{QName("p1") := $p1}"/>

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 26 September 2012 23:43:47 UTC