- From: <bugzilla@jessica.w3.org>
- Date: Sun, 05 Jan 2014 13:21:13 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24207
Bug ID: 24207
Summary: XPath-level element and attribute constructors for use
in anonymous functions
Product: XPath / XQuery / XSLT
Version: Last Call drafts
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P2
Component: XSLT 3.0
Assignee: mike@saxonica.com
Reporter: tgraham@mentea.net
QA Contact: public-qt-comments@w3.org
Anonymous functions are useful, but only if you don't want to create elements
or attributes using them.
In the absence of XPath-level constructors for elements and attributes, it
remains necessary to use a XSLT function definition if you want to write a
function that creates elements or attributes.
E.g., from
https://github.com/MenteaXML/xslt3testbed/blob/table-map/xml/table-test/orange.xsl:
----
<xsl:function name="x3tb:orange-table" as="attribute()*">
<xsl:param name="context" as="element()" />
<xsl:attribute name="background-color" select="'orange'" />
</xsl:function>
<xsl:template match="table[@style eq 'orange']">
<xsl:next-match>
<xsl:with-param
name="table-functions"
as="map(xs:string, function(element()) as attribute()*)"
select="map {
'table' := x3tb:orange-table#1
}"
tunnel="yes" />
</xsl:next-match>
</xsl:template>
----
The definition of the $table-functions parameter would have been simpler and
clearer if the attribute was able to be constructed in an anonymous function.
In this instance, an anonymous function could have referred to a XSLT variable
defining the constant attribute, but as this is just one instance of a general
mechanism that could return multiple attributes with values based on the
context, returning multiple attributes defined in multiple XSLT variables would
be even messier.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Sunday, 5 January 2014 13:21:14 UTC