title: Problems with OpenXML 2.5 XSL Transformation Word 2013 C#
body: <p>Can anyone help me out on this problem?
  I haven't done anything with OpenXML before and it has me stumped!</p>
  
  <p>I have a Word Document which is an invoice.
  In this document, I have the usual headers etc, plus the 'fields' which need to be populated with data from my XML dataset from SQLServer.</p>
  
  <p>I took a copy of the word/document.xml from the docx and made the recommended changes to the file to convert it into an XSLT file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  </code></pre>
  
  <p>becomes</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:xs="http://www.w3.org/2001/XMLSchema"
                  xmlns:n2="urn:hl7-org:v3"
              exclude-result-prefixes="n2 xs xsi xsl"&gt;
  &lt;xsl:output method="xml" encoding="UTF-8" indent="yes"/&gt;
  &lt;xsl:template match="/"&gt;
  </code></pre>
  
  <p>and the file is terminated with </p>
  
  <pre><code>&lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Then, I changed some of my 'fields' to show where I wanted the data to be merged.</p>
  
  <p>All well and good......</p>
  
  <p>When I ran it, I got a new file which looked OK but would not open in Word 2013. I pulled the document.xml out of the docx and tried to open that. This gave me an Unspecified Error Line 1 Column 1257.</p>
  
  <p>I have since tried all sorts of things, including creating an XSLT with no merge fields, just the headers and footers set up, and I get the same thing.</p>
  
  <p>I have tried several different headers with differing complexity and always get the same error.</p>
  
  <p>When I trace the error, it is in this tag line</p>
  
  <pre><code>&lt;w:document xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" 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:w15="http://schemas.microsoft.com/office/word/2012/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" mc:Ignorable="w14 w15 wp14"&gt;
  </code></pre>
  
  <p>which finishes with column 1257:  </p>
  
  <p>mc:Ignorable="w14 w15 wp14"></p>
  
  <p>I have checked that the namespaces are all declared but I cannot see, or understand, what is going wrong</p>
  
  <p>Any ideas?
  Thanks</p>