title: Modify xml with namespaces
body: <p>I'm trying to modify predefined xml (xsd to be more specific) in TSQL.
  I want to insert enumeration restriction to one of the xsd elements.</p>
  
  <p>The task is to fill xsd restrictions based on a query
  example:</p>
  
  <pre><code>create table #list(value nvarchar(100))
  insert into #list values('item 1')
  insert into #list values('item 2')
  insert into #list values('item 3')
  insert into #list values('item 4')
  insert into #list values('item 5')
  insert into #list values('item 6')
  
  declare @enumeration as xml
  ;with xmlnamespaces('http://www.w3.org/2001/XMLSchema' as xs)
  select @enumeration = (
      select value as '@value'
      from #list for xml path('xs:enumeration')
  )
  
  declare @schema xml
  set @schema =
  '&lt;xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="test"&gt;
      &lt;xs:element name="test" msdata:IsDataSet="true" msdata:MainDataTable="Example" msdata:UseCurrentLocale="true"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:choice maxOccurs="unbounded"&gt;
                  &lt;xs:element name="Example"&gt;
                      &lt;xs:complexType&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element name="myList" minOccurs="1" nillable="false"&gt;
                                  &lt;xs:simpleType&gt;
                                      &lt;xs:restriction base="xs:string"&gt;
                                          &lt;xs:maxLength value="50" /&gt;
                                      &lt;/xs:restriction&gt;
                                  &lt;/xs:simpleType&gt;
                              &lt;/xs:element&gt;
                          &lt;/xs:sequence&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:choice&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;'
  
  set @schema.modify
      ('insert sql:variable("@enumeration")
      into (//xs:element[@name=''myList'']/xs:simpleType/xs:restriction)[1]')
  
  select @schema
  </code></pre>
  
  <p>The problem is that code outputs unnecessary xmlns attribute</p>
  
  <pre><code>&lt;xs:enumeration xmlns:xs="http://www.w3.org/2001/XMLSchema" value="item 1" /&gt;
  </code></pre>
  
  <p>Can anyone help ?</p>