title: Remove word proofing errors from WordML
body: <p>I have the same problem as <a href="https://stackoverflow.com/questions/939898/remove-word-proofing-errors-from-wordml-and-merge-the-nodes">Remove word proofing errors from WordML and merge the nodes</a> -- to which @Rupesh_Kr provided a suggested xsl template. How do I use it (insufficient reputation to ask there)? What I hope it does is remove the Microsoft Word XML tags proofErr w:type="spellStart" and w:type="spellEnd" that break lines in my document. I currently use XSL to produce more diff'able results by adding carriage returns so I tried to replace that with his and use the command "msxsl.exe -xe procedure.xml xml.xsl" where xml.xsl contains his suggestion but get the following error:</p>
  
  <pre><code>Code:   0xc00ce01d
  URL:    file:///xml.xsl
  Line:   17
  Column: 12
  Reference to undeclared namespace prefix: 'w'.
  </code></pre>
  
  <p>xml.xsl contains his suggestion as shown below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
    &lt;!--
     ! This is an XML to XML transformation intended to be imported into a host
     ! XSLT.  The source .xml file is copied verbatim by default.
     ! The importing XSL Transform should specify xsl:output as xml, and should
     ! contain templates to override the node and attribute match made here so
     ! that it can transform specific portions of the original XML file.
      --&gt;
  
    &lt;xsl:output method="xml" encoding="utf-8" indent="yes" /&gt;
  
    &lt;!-- ========================================================================
      --&gt;
    &lt;xsl:template match="w:p[w:proofErr]/w:r[1]"&gt;
        &lt;w:r&gt;
            &lt;w:t&gt;
            &lt;xsl:value-of select=".."/&gt;
            &lt;/w:t&gt;
        &lt;/w:r&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="w:p[w:proofErr]/w:r[position() &gt; 1]"/&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>An example input file follows, simplified by removing many MS Word definitions:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?mso-application progid="Word.Document"?&gt;
  &lt;w:wordDocument w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"&gt;
  &lt;w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"&gt;&lt;/w:ignoreSubtree&gt;
  &lt;o:DocumentProperties&gt;
  &lt;o:Lines&gt;1&lt;/o:Lines&gt;
  &lt;/o:DocumentProperties&gt;
  &lt;w:fonts&gt;
  &lt;/w:fonts&gt;
  &lt;w:body&gt;
  &lt;wx:sect&gt;
  &lt;w:p&gt;
  &lt;w:pPr&gt;
  &lt;w:pStyle w:val="BodyText"&gt;&lt;/w:pStyle&gt;
  &lt;/w:pPr&gt;
  &lt;w:proofErr w:type="spellStart"&gt;&lt;/w:proofErr&gt;
  &lt;w:r&gt;
  &lt;w:t&gt;Hellow&lt;/w:t&gt;
  &lt;/w:r&gt;
  &lt;w:proofErr w:type="spellEnd"&gt;&lt;/w:proofErr&gt;
  &lt;w:r&gt;
  &lt;w:t&gt; &lt;/w:t&gt;
  &lt;/w:r&gt;
  &lt;w:proofErr w:type="spellStart"&gt;&lt;/w:proofErr&gt;
  &lt;w:r&gt;
  &lt;w:t&gt;world!&lt;/w:t&gt;
  &lt;/w:r&gt;
  &lt;w:proofErr w:type="spellEnd"&gt;&lt;/w:proofErr&gt;
  &lt;/w:p&gt;
  &lt;w:sectPr&gt;
  &lt;w:ftr w:type="odd"&gt;
  &lt;/w:ftr&gt;
  &lt;/w:sectPr&gt;
  &lt;/wx:sect&gt;
  &lt;/w:body&gt;
  &lt;/w:wordDocument&gt;
  </code></pre>
  
  <p>Desired output would be:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?mso-application progid="Word.Document"?&gt;
  &lt;w:wordDocument w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"&gt;
  &lt;w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"&gt;&lt;/w:ignoreSubtree&gt;
  &lt;o:DocumentProperties&gt;
  &lt;o:Lines&gt;1&lt;/o:Lines&gt;
  &lt;/o:DocumentProperties&gt;
  &lt;w:fonts&gt;
  &lt;/w:fonts&gt;
  &lt;w:body&gt;
  &lt;wx:sect&gt;
  &lt;w:p&gt;
  &lt;w:pPr&gt;
  &lt;w:pStyle w:val="BodyText"&gt;&lt;/w:pStyle&gt;
  &lt;/w:pPr&gt;
  &lt;w:r&gt;
  &lt;w:t&gt;Hellow world!&lt;/w:t&gt;
  &lt;/w:r&gt;
  &lt;/w:p&gt;
  &lt;w:sectPr&gt;
  &lt;w:ftr w:type="odd"&gt;
  &lt;/w:ftr&gt;
  &lt;/w:sectPr&gt;
  &lt;/wx:sect&gt;
  &lt;/w:body&gt;
  &lt;/w:wordDocument&gt;
  </code></pre>