[Bug 2257] [xqueryx] brace groups in element content.

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

           Summary: [xqueryx]  brace groups in element content.
           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


Currently (15th september)
the stylesheet puts a brace group around each item in the content
of a direct element constructor. It should not do this if the item is itself a
direct element constructor, ie the xsl:if tests below should be added.

  <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>


Without this change XqueryX can not express the equivalent of
<y><z xmlns:a="a"/></y>
the nearest it can get is
<y>{<z xmlns:a="a"/>}</y>

But these are not equivalent:

  declare copy-namespaces no-preserve,no-inherit;
  <y><z xmlns:a="a"/></y>

evaluates to

 <y><z xmlns:a="a"/></y>


but


  declare copy-namespaces no-preserve,no-inherit;
  <y>{<z xmlns:a="a"/>}</y>

evaluates to

 <y><z/></y>

as the copy-namespace declaration has no effect on the directly embedded
element constructor in the first example, but does affect (prohibit)
the copying of the namespace when the sequence constructed by the
enclosed expression is copied in the second example.

David

Received on Friday, 16 September 2005 11:06:38 UTC