Bug 5343 - [XQX] Problem with {{ and }} in a Namespace Declaration Attribute
Summary: [XQX] Problem with {{ and }} in a Namespace Declaration Attribute
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQueryX 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-03 23:53 UTC by Andrew Eisenberg
Modified: 2008-02-14 20:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Eisenberg 2008-01-03 23:53:46 UTC
Test case K2-DirectConElemNamespace-76 in XQTS contains the following query:

<e xmlns:p="{{1}}"/>

The XQueryX generated by the XQuery 1.0 applet for this query is:

<?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:queryBody>
      <xqx:elementConstructor>
        <xqx:tagName>e</xqx:tagName>
        <xqx:attributeList>
          <xqx:namespaceDeclaration>
            <xqx:prefix>p</xqx:prefix>
            <xqx:uri>{1}</xqx:uri>
          </xqx:namespaceDeclaration>
        </xqx:attributeList>
      </xqx:elementConstructor>
    </xqx:queryBody>
  </xqx:mainModule>
</xqx:module>


The application of our xqueryx.xsl stylesheet to this XQueryX generates the following:

<e xmlns:p="{1}"></e>


This generated query was recently determined to be invalid (see Bug #5083).

I suggest that the xqueryx.xsl stylesheet needs to be changed. I note that the template for xqx:attributeConstructor converts { and } to {{ and }}, respectively. The template for xqx:namespaceDeclaration does not do this.
Comment 1 Andrew Eisenberg 2008-01-04 16:30:54 UTC
This could be solved by changing the template for xqx:namespaceDeclaration from:

  <xsl:template match="xqx:namespaceDeclaration">
    <xsl:text> xmlns</xsl:text>
    <xsl:if test="xqx:prefix">
      <xsl:text>:</xsl:text>
      <xsl:value-of select="xqx:prefix"/>
    </xsl:if>
    <xsl:value-of select="$EQUAL"/>
    <xsl:call-template name="quote">
      <xsl:with-param name="item" select="xqx:uri"/>
    </xsl:call-template>
  </xsl:template>


to the following:

  <xsl:template match="xqx:namespaceDeclaration">
    <xsl:text> xmlns</xsl:text>
    <xsl:if test="xqx:prefix">
      <xsl:text>:</xsl:text>
      <xsl:value-of select="xqx:prefix"/>
    </xsl:if>
    <xsl:value-of select="$EQUAL"/>
    <xsl:call-template name="quote">
                  <xsl:with-param name="item">
                    <xsl:call-template name="globalReplace">
                      <xsl:with-param name="stringToBeFixed">
                        <xsl:call-template name="globalReplace">
                          <xsl:with-param name="stringToBeFixed">
                            <xsl:value-of select="xqx:uri"/>
                          </xsl:with-param>
                          <xsl:with-param name="toBeReplaced"><xsl:text>{</xsl:text></xsl:with-param>
                          <xsl:with-param name="replacement"><xsl:text>{{</xsl:text></xsl:with-param>
                        </xsl:call-template>
                      </xsl:with-param>
                      <xsl:with-param name="toBeReplaced"><xsl:text>}</xsl:text></xsl:with-param>
                      <xsl:with-param name="replacement"><xsl:text>}}</xsl:text></xsl:with-param>
                    </xsl:call-template>
                  </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

Comment 2 Jim Melton 2008-02-14 01:28:01 UTC
In its face-to-face meetings during 2008-01-21 through 2008-01-23 (minutes
found in member-only email at http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2008Feb/0006.html), the XML Query WG made the decision to correct this error with an entry in the next version of the XQueryX Errata document.  That correction is that shown in comment #1 of this bug.  

We are marking this bug RESOLVED and FIXED.  If you are satisfied with this
resolution, please mark it CLOSED.  If you are not, please add another comment
to this bug explaining your reasons.