title: Adding header and footer in an XSLT file
body: <p>I have an XSLT file which transforms an XML into a word document. My problem is I want to add headers and footer in the document. How do I do it?</p>
  
  <p>My question is basically similar to this <a href="https://stackoverflow.com/questions/4838613/header-and-footer-and-page-numbers-using-xslt">Header and footer and page numbers using xslt</a>.</p>
  
  <p>More help about headers and footers can be found <a href="http://www.w3schools.com/xslfo/obj_region-after.asp" rel="nofollow noreferrer">here</a>. Basically I need to use these tags but how do I use it in my template? Do I put it in the end or somewhere in the middle? I would also like to change the word page layout to landscape which is portrait be default.</p>
  
  <pre><code>&lt;fo:region-before&gt; defines the top region (header)
  &lt;fo:region-after&gt; defines the bottom region (footer)
  </code></pre>
  
  <p>Assume this is my XSLT</p>
  
  
  
  <p></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
      &lt;h2&gt;My CD Collection&lt;/h2&gt;
      &lt;table border="1"&gt;
        &lt;tr bgcolor="#9acd32"&gt;
          &lt;th&gt;Title&lt;/th&gt;
          &lt;th&gt;Artist&lt;/th&gt;
        &lt;/tr&gt;
        &lt;xsl:for-each select="catalog/cd"&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;xsl:value-of select="title"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;xsl:value-of select="artist"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/xsl:for-each&gt;
      &lt;/table&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>The above example has been copied from <a href="http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&amp;xsltfile=cdcatalog" rel="nofollow noreferrer">w3school</a></p>