[Bug 2258] [xqueryx] XQueryX fragments

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

           Summary: [xqueryx]  XQueryX fragments
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          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


Should XQueryX allow documents that have top level element something
other than xqx:Module?

In Xquery it is clear that 1 is a valid expression and [1] is not, even
though it matches the production Predicate, as the Xquery EBNF has a
specified start production, and it is not possible to parse [1] starting
from Module. Unfortunately XSD schema can not specify a starting (top
level) element.

It would be possible to restrict the top level elements by making all
other element declarations local, but that would badly disrupt the
current mechanisms of using substitution groups which can only refer to
globally defined eleemnts.

However an alternative would be to make this restriction in the
stylesheet:

<xsl:template match="/*">
 <xsl:message terminate="yes">don't do that</xsl:message>
</xsl:template>

<xsl:template match="/xqx:module" priority="2">
  ....


Without such a restriction there are several examples of documents that
are valid against the xqueryx schema, and generate valid xquery
expressions when processed with the stylesheet, but which have rather
unfortunate meanings.

1
======================
<xqx:atomicType
xmlns:xqx="http://www.w3.org/2005/XQueryX">a</xqx:atomicType>

This is
a
and selects an element of that name, despite using xqx:atomicType
======================


2
======================
<xqx:resultExpr xmlns:xqx="http://www.w3.org/2005/XQueryX">
<xqx:contextItemExpr/>
</xqx:resultExpr>

this is 
.
so the resultExpr element isn't restricted to typeswitch (it's intended
usage)


======================

3
======================
<xqx:attributeList xmlns:xqx="http://www.w3.org/2005/XQueryX">
<xqx:attributeConstructor>
<xqx:attributeName>x</xqx:attributeName>
<xqx:attributeValue>y</xqx:attributeValue>
</xqx:attributeConstructor>
</xqx:attributeList>

this doesn't construct attributes, but is instead
 x="y"
which tests if the child element x is equal to the string "y"
======================


there are other examples, but these are all of the same basic type and
would all be fixed if XqueryX documents were not allowed to start at
arbitrary elements.

Received on Friday, 16 September 2005 11:30:10 UTC