title: Insert new xml attribute into MS Word xml document element
body: <p>I want to prevent word document fields getting updated by setting a lock using the field <code>w:fldLock</code>. I have an <code>xml</code> file which contains the node <code>w:fldSimple</code>. Whenever I find this node I want to set the attribute <code>w:fldLock</code> to this node. To achieve this I want to use XSLT transformation. Can you please advise me the sample XSL Transformation?</p>
  
  <p>Example xml Data:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;w:hdr mc:Ignorable="w14 wp14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"&gt;
     &lt;w:p w:rsidR="00235C27" w:rsidRDefault="00235C27"&gt;
        &lt;w:pPr&gt;
           &lt;w:pStyle w:val="Header" /&gt;
        &lt;/w:pPr&gt;
        &lt;w:fldSimple w:instr="MERGEFIELD firstname \* MERGEFORMAT"&gt;
           &lt;w:r&gt;
              &lt;w:rPr&gt;
                 &lt;w:noProof /&gt;
              &lt;/w:rPr&gt;
              &lt;w:t&gt;John&lt;/w:t&gt;
           &lt;/w:r&gt;
        &lt;/w:fldSimple&gt;
     &lt;/w:p&gt;
  &lt;/w:hdr&gt;
  </code></pre>
  
  <p>After the XSLT my output should be an xml file like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;w:hdr mc:Ignorable="w14 wp14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"&gt;
     &lt;w:p w:rsidR="00235C27" w:rsidRDefault="00235C27"&gt;
        &lt;w:pPr&gt;
           &lt;w:pStyle w:val="Header" /&gt;
        &lt;/w:pPr&gt;
        &lt;w:fldSimple w:instr="MERGEFIELD firstname \* MERGEFORMAT" w:fldLock = "1"&gt;
           &lt;w:r&gt;
              &lt;w:rPr&gt;
                 &lt;w:noProof /&gt;
              &lt;/w:rPr&gt;
              &lt;w:t&gt;John&lt;/w:t&gt;
           &lt;/w:r&gt;
        &lt;/w:fldSimple&gt;
     &lt;/w:p&gt;
  &lt;/w:hdr&gt;
  </code></pre>
  
  <p>Please advise me on this?</p>