[Bug 2710] [xqueryx and xquery] extra white space in pragma content

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2710

           Summary: [xqueryx and xquery] extra white space in pragma content
           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


The stylesheet has
 <xsl:variable name="PRAGMA_BEGIN" select="'(# '"/>
 <xsl:variable name="PRAGMA_END" select="' #)'"/>
which means that a space is inserted at the beginging and end of each pragma.
The stylesheet also inserts a space between the name and pragmacontents.

so the xqueryx
<xqx:pragma>
  <xqx:pragmaName>a</xqx:pragmaName>
  <xqx:pragmaContents>b</xqx:pragmaContents>
</xqx:pragma>

is defined to mean the same as the xquery
(# a b #)

The EBNF for this expression is
[66]    	Pragma 	   ::=    	"(#" S? QName PragmaContents "#)"
so the first space has no effect but both of the second two spaces end up being
parsed as pragmacontent. Since the semantics of this are implementation defined,
this may or may not have an effect. However whether or not a sytem treats them
differently here is no XqueryX expression corresponding to xquery expressions
which do not have space in pragmacontent, such as
(#a+b#}{1}
which is a valid Xquery with pragma with name a and content +b

The final space is easy to fix, $PRAGMA_END should just be '#)'

However the middle space is harder, I think that the best fix would be for the
stylesheet to continue to insert a space between the name and content but the
XQuery EBNF modified to
[66]    	Pragma 	   ::=    	"(#" S? QName (S PragmaContents)? "#)"
so that if you have any contents, they have to be separated by white space from
the name (which would make my (#a+b#} example above a syntax error)

David

Received on Friday, 13 January 2006 11:46:30 UTC