<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>21025</bug_id>
          
          <creation_ts>2013-02-17 11:00:44 +0000</creation_ts>
          <short_desc>[XQ 3.0] copying unused namespace declarations</short_desc>
          <delta_ts>2013-05-09 19:43:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nikolay Ognyanov">nikolay.ognyanov</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>mike</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83236</commentid>
    <comment_count>0</comment_count>
    <who name="Nikolay Ognyanov">nikolay.ognyanov</who>
    <bug_when>2013-02-17 11:00:44 +0000</bug_when>
    <thetext>It seems to me that the draft specs do not provide a way to copy &quot;unused&quot; (i.e. such that no element in the documet resides in those) namespace declarations from a processed xml document. There are however important use cases where such feature is needed. For example xml schema documents often require declaration of default namespace even though the elements of the schema itself all reside in the xs: namespace. The namespace axis in combination with computed namespace constructors would solve this but namespace axix is explicitely not supported. Am I missing an alternative solution or is the use case truly not supported? If so then I would advocate strongly for its support since processing of xml schema documents is hardly an insignificant use case.

Regards
Nikolay

P.S.: For examples of xml schemas where copying of the default namespace is mandatory you can look e.g. at http://www.opentravel.org/Specifications/Default.aspx</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83237</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-02-17 11:18:31 +0000</bug_when>
    <thetext>Personal response: I agree there are many use cases where this would be convenient, and indeed where the namespace axis would be convenient. However, there is a workaround in 3.0 (unlike 1.0) which will have to do for now: you can use 

in-scope-prefixes($e)!namespace-node(){.}{namespace-uri-for-prefix($e,.)}

to &quot;reconstruct&quot; the namespace nodes for element $e that you would have found using the namespace axis if it were available.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83238</commentid>
    <comment_count>2</comment_count>
    <who name="Nikolay Ognyanov">nikolay.ognyanov</who>
    <bug_when>2013-02-17 12:33:39 +0000</bug_when>
    <thetext>Mea culpa! Your suggestion works (except for the order of arguments of namespace-uri-for-prefix) and I have missed this workaround. I am afraid though that many other users of xquery 3.0 will miss it too. Therefore I would like to modify this filing into a suggestion to improve the draft documentation to point out more explicitely what alternatives to the namespace axis are provided.

Regards
Nikolay</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84635</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-03-19 17:08:31 +0000</bug_when>
    <thetext>(In reply to comment #1)

&gt; in-scope-prefixes($e)!namespace-node(){.}{namespace-uri-for-prefix($e,.)}

I was confused by &quot;namespace-node()&quot; in the above example. The correct syntax is:

in-scope-prefixes($e) ! namespace {namespace-uri-for-prefix($e,.)} {.}

This is editorial; I do think an example would be helpful.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87511</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-05-09 19:43:13 +0000</bug_when>
    <thetext>I just checked in the example for the XQuery specification.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>