- From: <bugzilla@wiggum.w3.org>
- Date: Wed, 16 Nov 2005 00:09:12 +0000
- To: public-qt-comments@w3.org
- Cc:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2528 Summary: [xqueryx] check for node tests in xsl Product: XPath / XQuery / XSLT Version: Candidate Recommendation Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: XQueryX AssignedTo: jim.melton@acm.org ReportedBy: davidc@nag.co.uk QAContact: public-qt-comments@w3.org <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>
Received on Wednesday, 16 November 2005 00:09:26 UTC