title: Show different header on first page of RTF template (BI publisher)
body: <p>I came across a problem while creating RTF template for BI publisher. I am displaying a table in the header (not an MS word header but header identified as something above <em>start:body</em> tag) of an RTF template. That table has 3 rows, I need to display one of those rows only in the first page and not in other pages.</p>
  
  <p>I did not find any method on querying for the page number. So, I used a flag in the following manner: (Here, suffix _f denotes RTF field). The following is what my RTF file looks like:</p>
  
  <pre><code>+---------------------------------------------------------------------------------+
  ¦ init_f ¦    Row to be shown on all the pages     ¦                              ¦
  ¦--------+-----------------------------------------+------------------------------¦
  ¦ if_f   ¦ Row to be shown on the first page only. ¦   end_if_f change_variable_f ¦
  +---------------------------------------------------------------------------------+
  
  &lt;?start:body?&gt;
  
  other stuff
  
  &lt;?end body?&gt;
  </code></pre>
  
  <p>Where,</p>
  
  <p><strong>init_f</strong></p>
  
  <pre><code>&lt;?if: (xdoxslt:get_variable($_XDOCTX,'FLAG')!='NONFIRST')?&gt;&lt;?xdoxslt:set_variable($_XDOCTX,'FLAG','FIRST')?&gt;&lt;?end if?&gt;
  </code></pre>
  
  <p><strong>if_f</strong></p>
  
  <pre><code>&lt;?if: (xdoxslt:get_variable($_XDOCTX,'FLAG'))='FIRST'?&gt;
  </code></pre>
  
  <p><strong>end_if_f</strong></p>
  
  <pre><code>&lt;?end if?&gt;
  </code></pre>
  
  <p><strong>change_variable_f</strong></p>
  
  <pre><code>&lt;?xdoxslt:set_variable($_XDOCTX,'FLAG','NONFIRST')?&gt;
  </code></pre>
  
  <p>BUT, I still see all the rows in all the pages. It seems like the value of variable 'FLAG' is not preserved between different pages. To me, it seems like, header is generated once and same header is used in all the pages. What is the solution?</p>