title: How to add header and footer for every pages in xsl-fo to generate pdf
body: <p>please find the following xsl-fo , tried to set header and footer for every page in pdf, but got only header at first page and footer at last page. But here i needed for every page. How to perform this.</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" xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt;
  &lt;xsl:template match='/'&gt;
      &lt;fo:root&gt;
          &lt;fo:layout-master-set&gt;
              &lt;fo:simple-page-master master-name="my-page"
                                 page-height="29.7cm"
                    page-width="21cm"
                    margin-top="1cm"
                    margin-bottom="0.1cm"
                    margin-left="0.8cm"
                    margin-right="1.0cm" &gt;
                  &lt;fo:region-body margin-top="2.5cm" margin-bottom="2.5cm"/&gt;
                  &lt;fo:region-before extent="2.0cm"/&gt;
                  &lt;fo:region-after extent="2.0cm"/&gt;
              &lt;/fo:simple-page-master&gt;
          &lt;/fo:layout-master-set&gt;
          &lt;fo:page-sequence master-reference="my-page"&gt;
              &lt;fo:flow flow-name="xsl-region-before"&gt;
                  &lt;fo:block&gt;
                      Message Body
                  &lt;/fo:block&gt;
              &lt;/fo:flow&gt;
              &lt;fo:flow flow-name="xsl-region-body"&gt;
                  Message Content
              &lt;/fo:flow&gt;
  
              &lt;fo:flow flow-name="xsl-region-after"&gt;
                  &lt;h2&gt;
                      Page Footer
                  &lt;/h2&gt;
              &lt;/fo:flow&gt;
          &lt;/fo:page-sequence&gt;
      &lt;/fo:root&gt;
  &lt;/xsl:template&gt;
  &lt;xsl:template name="replace-returns"&gt;
      &lt;xsl:param name="text"/&gt;
      &lt;xsl:choose&gt;
          &lt;xsl:when test="contains($text, '&amp;#xa;')"&gt;
              &lt;xsl:value-of select="substring-before($text, '&amp;#xa;')"/&gt;
              &lt;xsl:value-of select="'&amp;lt;br /&amp;gt;'" disable-output-escaping="yes"/&gt;
              &lt;xsl:call-template name="replace-returns"&gt;
                  &lt;xsl:with-param name="text" select="substring-after($text, '&amp;#xa;')"/&gt;
              &lt;/xsl:call-template&gt;
          &lt;/xsl:when&gt;
          &lt;xsl:otherwise&gt;
              &lt;xsl:value-of select="$text"/&gt;
          &lt;/xsl:otherwise&gt;
      &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p></p>