title: Add an attribute to an element in an existing XML using Xquery
body: <p>I need to add an attribute to an element of my response XML using XQuery. 
  Take the below XML as input,</p>
  
  <pre><code>&lt;xyz:RootNode xmlns:abc="url1" xmlns:xyz="url2"&gt;
    &lt;abc:OtherNodes/&gt;
    &lt;abc:messageHeader att1="val1" att2="val2"&gt;
         &lt;abc:childNodes/&gt;  
    &lt;/abc:messageHeader&gt;
    &lt;abc:OtherNodes/&gt;
  &lt;/xyz:RootNode&gt;
  </code></pre>
  
  <p>Need an Xquery that add one more attribute <strong>newAtt</strong> with value <strong>newVal</strong> and give the result as,</p>
  
  <pre><code>&lt;xyz:RootNode xmlns:abc="url1" xmlns:xyz="url2"&gt;
     &lt;abc:OtherNodes/&gt;
     &lt;abc:messageHeader att1="val1" att2="val2" newAtt="newVal"&gt;
         &lt;abc:childNodes/&gt;  
    &lt;/abc:messageHeader&gt;
    &lt;abc:OtherNodes&gt;
  &lt;/xyz:RootNode&gt;
  </code></pre>
  
  <p>Each time the number of attributes of message header may change. So the query should add a new attribute along with all the existing attributes and return the whole document. </p>