This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
<xsl:template match="xqx:functionCallExpr"> <xsl:if test="xqx:functionName/@xqx:prefix"> <xsl:value-of select="xqx:functionName/@xqx:prefix"/> <xsl:value-of select="$COLON"/> </xsl:if> <xsl:if test="xqx:functionName = 'node' or xqx:functionName = 'document-node' or xqx:functionName = 'element' or xqx:functionName = 'attribute' or xqx:functionName = 'schema-element' or xqx:functionName = 'schema-attribute' or xqx:functionName = 'processing-instruction' or xqx:functionName = 'comment' or xqx:functionName = 'text' or xqx:functionName = 'item' or xqx:functionName = 'if' or xqx:functionName = 'typeswitch' or xqx:functionName = 'empty-sequence'"> <xsl:text>fn:error()</xsl:text> </xsl:if> <xsl:value-of select="xqx:functionName"/> The check on 'node' and friends needs to be moved into a branch that only happens if there is no xqx:prefix. Currently the stylesheet rejects the xqx version of the valid, executable XQuery declare namespace x = "x"; declare function x:text () {()}; x:text() ` as it rejects any function with local name "text". The result of the stylesheet in this case also reveals a couple more problems declare namespace x="x"; declare function x:text() { () }; x:fn:error()text() The resulting Query does not include a call to fn:error() as intended as this is mixed up with the function call that is being flagged as an error,and the result is that the Query does not parse, which is a kind of error, but I don't think it was as intended. It would be easy to arrange the template so that in the branch that generates error() the original function nameand arguments were dropped completely, although this would then still fail if fn: namespace has been redeclared. It would be safer to generate the error message during the transformation with an xsl:message terminate="yes" rather than trying to cause the generated query to always raise an error. and for completeness the xqueryx version of the Xquery test shown above: <xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"> <xqx:mainModule> <xqx:prolog> <xqx:namespaceDecl> <xqx:prefix>x</xqx:prefix> <xqx:uri>x</xqx:uri> </xqx:namespaceDecl> <xqx:functionDecl> <xqx:functionName xqx:prefix="x">text</xqx:functionName> <xqx:paramList/> <xqx:functionBody> <xqx:sequenceExpr/> </xqx:functionBody> </xqx:functionDecl> </xqx:prolog> <xqx:queryBody> <xqx:functionCallExpr> <xqx:functionName xqx:prefix="x">text</xqx:functionName> <xqx:arguments/> </xqx:functionCallExpr> </xqx:queryBody> </xqx:mainModule> </xqx:module>
Two very nice catches, indeed! I will propose to the Working Groups that I be directed to modify the template for xqx:functionCallExpr in the ways you suggested. The proposal will be that the template look something like this: <xsl:template match="xqx:functionCallExpr"> <xsl:choose> <xsl:when test="xqx:functionName/@xqx:prefix"> <xsl:value-of select="xqx:functionName/@xqx:prefix"/> <xsl:value-of select="$COLON"/> </xsl:when> <xsl:otherwise> <xsl:if test="xqx:functionName = 'node' or xqx:functionName = 'document-node' or xqx:functionName = 'element' or xqx:functionName = 'attribute' or xqx:functionName = 'schema-element' or xqx:functionName = 'schema-attribute' or xqx:functionName = 'processing-instruction' or xqx:functionName = 'comment' or xqx:functionName = 'text' or xqx:functionName = 'item' or xqx:functionName = 'if' or xqx:functionName = 'typeswitch' or xqx:functionName = 'empty-sequence'"> <xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable> <xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:value-of select="xqx:functionName"/> <xsl:choose> <xsl:when test="xqx:arguments"> <xsl:for-each select="xqx:arguments"> <xsl:call-template name="parenthesizedList"/> </xsl:for-each> </xsl:when> <xsl:otherwise> <xsl:value-of select="$LPAREN"/> <xsl:value-of select="$RPAREN"/> </xsl:otherwise> </xsl:choose> </xsl:template> Your additional thoughts and comments on this proposed solution would be welcomed.
The XML Query WG has considered your comment and the response suggested in additional comment #1, and has agreed to adopt the solution proposed in that response as the resolution of your comment. This is the official WG response. Please let us know if you agree with this resolution of your issue, by adding a comment to the issue record and changing the Status of the issue to Closed. Or, if you do not agree with this resolution, please add a comment explaining why. If you wish to appeal the WG's decision to the Director, then also change the Status of the record to Reopened. If you wish to record your dissent, but do not wish to appeal the decision to the Director, then change the Status of the record to Closed. If we do not hear from you in the next two weeks, we will assume you agree with the WG decision.
looks fine to me, thanks