- From: <bugzilla@jessica.w3.org>
- Date: Mon, 16 Jan 2017 11:44:33 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=30049
Bug ID: 30049
Summary: [XSLT30] Request for clarification if xsl:evaluate
example supposed to implement function-lookup is
supposed to return empty sequence if function is not
found
Product: XPath / XQuery / XSLT
Version: Candidate Recommendation
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: XSLT 3.0
Assignee: mike@saxonica.com
Reporter: martin.honnen@gmx.de
QA Contact: public-qt-comments@w3.org
Target Milestone: ---
https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#evaluate-examples
has an example saying
----------------------------------------------------------------------
The function-lookupFO30 function, if it were not available in the standard
library, could be implemented like this:
<xsl:function name="f:function-lookup">
<xsl:param name="name" as="xs:QName"/>
<xsl:param name="arity" as="xs:integer"/>
<xsl:evaluate xpath="'Q{' || namespace-uri-from-QName($name) || '}'
|| local-name-from-QName($name) || '#' || $arity">
<xsl:with-param name="name" as="xs:QName" select="$name"/>
<xsl:with-param name="arity" as="xs:integer" select="$arity"/>
</xsl:evaluate>
</xsl:function>
The xsl:evaluate instruction uses the supplied QName and arity to construct an
expression of the form Q{namespace-uri}local#arity, which is then evaluated to
return a function item representing the requested function.
--------------------------------------------------------------------------
However, the FO30/31 'function-lookup'
https://www.w3.org/TR/xpath-functions-30/#func-function-lookup has the
signature fn:function-lookup($name as xs:QName, $arity as xs:integer) as
function(*)? and is defined to return an empty sequence if the function is not
found: "Otherwise (if no known function can be identified by name and arity),
an empty sequence is returned".
As far as I can tell and have tested, above example of using xsl:evaluate
inside of the function declaration of 'f:function-lookup' will return an error
XTDE3160 if the function is not found so in that case it is not an
implementation of 'function-lookup' and behaves differently.
So I think either the explanation should say that 'f:function-lookup' behaves
slightly differently or the function implementation needs to be fixed to
<xsl:function name="f:function-lookup">
<xsl:param name="name" as="xs:QName"/>
<xsl:param name="arity" as="xs:integer"/>
<xsl:try>
<xsl:evaluate xpath="'Q{' || namespace-uri-from-QName($name) || '}'
|| local-name-from-QName($name) || '#' || $arity">
<xsl:with-param name="name" as="xs:QName" select="$name"/>
<xsl:with-param name="arity" as="xs:integer" select="$arity"/>
</xsl:evaluate>
<xsl:catch errors="err:XTDE3160" select="()"/>
</xsl:try>
</xsl:function>
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Monday, 16 January 2017 11:44:40 UTC