- From: <bugzilla@wiggum.w3.org>
- Date: Tue, 26 Feb 2008 20:47:52 +0000
- To: public-qt-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4869
andrew.eisenberg@us.ibm.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrew.eisenberg@us.ibm.com,
| |jim.melton@acm.org
------- Comment #26 from andrew.eisenberg@us.ibm.com 2008-02-26 20:47 -------
How interesting. I used the XQuery 1.0 grammar applet to convert the query
provided in the original entry:
declare copy-namespaces no-preserve, inherit;
<doc>
<a>{<b xmlns:p="q"/>}</a>
<a><b xmlns:p="q"/></a>
</doc>
into XQueryX:
<?xml version="1.0"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/XQueryX
http://www.w3.org/2005/XQueryX/xqueryx.xsd">
<xqx:mainModule>
<xqx:prolog>
<xqx:copyNamespacesDecl>
<xqx:preserveMode>no-preserve</xqx:preserveMode>
<xqx:inheritMode>inherit</xqx:inheritMode>
</xqx:copyNamespacesDecl>
</xqx:prolog>
<xqx:queryBody>
<xqx:elementConstructor>
<xqx:tagName>doc</xqx:tagName>
<xqx:elementContent>
<xqx:elementConstructor>
<xqx:tagName>a</xqx:tagName>
<xqx:elementContent>
<xqx:elementConstructor>
<xqx:tagName>b</xqx:tagName>
<xqx:attributeList>
<xqx:namespaceDeclaration>
<xqx:prefix>p</xqx:prefix>
<xqx:uri>q</xqx:uri>
</xqx:namespaceDeclaration>
</xqx:attributeList>
</xqx:elementConstructor>
</xqx:elementContent>
</xqx:elementConstructor>
<xqx:elementConstructor>
<xqx:tagName>a</xqx:tagName>
<xqx:elementContent>
<xqx:elementConstructor>
<xqx:tagName>b</xqx:tagName>
<xqx:attributeList>
<xqx:namespaceDeclaration>
<xqx:prefix>p</xqx:prefix>
<xqx:uri>q</xqx:uri>
</xqx:namespaceDeclaration>
</xqx:attributeList>
</xqx:elementConstructor>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:queryBody>
</xqx:mainModule>
</xqx:module>
The constructors for the two a elements are exactly the same.
Looking at the XQueryX schema, I see:
<xsd:element name="elementContent" type="exprList"/>
<xsd:complexType name="elementConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="tagName" type="QName"/>
<xsd:element ref="attributeList" minOccurs="0"/>
<xsd:element ref="elementContent" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
I don't see any way to write these two constructors any differently to
distinguish them.
Looking further, I see the following rules in the XQueryX stylesheet:
<xsl:template match="xqx:elementContent">
<xsl:for-each select="*">
<xsl:if test="not(self::xqx:elementConstructor)">
<xsl:value-of select="$LBRACE"/>
</xsl:if>
<xsl:apply-templates select="."/>
<xsl:if test="not(self::xqx:elementConstructor)">
<xsl:value-of select="$RBRACE"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="xqx:elementConstructor">
<xsl:value-of select="$LESSTHAN"/>
<xsl:apply-templates select="xqx:tagName"/>
<xsl:apply-templates select="xqx:attributeList"/>
<xsl:value-of select="$GREATERTHAN"/>
<xsl:apply-templates select="xqx:elementContent"/>
<xsl:value-of select="$LESSTHAN"/>
<xsl:value-of select="$SLASH"/>
<xsl:apply-templates select="xqx:tagName"/>
<xsl:value-of select="$GREATERTHAN"/>
</xsl:template>
If direct element constructors are nested, then braces will not be generated.
Otherwise, braces are generated.
The upshot of all of this? I believe that if we retain the semantics that cause
these two constructors to create different elements, then XQueryX needs to be
changed.
Received on Tuesday, 26 February 2008 20:48:01 UTC