You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Seshadri G.K." <se...@mindfiresolutions.com> on 2001/03/19 10:36:51 UTC

Re: FOP 0.15 - Using XSL:FO style sheet, can I detect which page I am on?

FOP 0.15 - Using XSL:FO style sheet, can I detect which page I am on?
You seem to want to detect which page u are on? Why? It seems you just need to use the odd-or-even feature. 

Example 

<fo:page-sequence-master master-name="run2">
   <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference
     master-name="with_optical_mark"
     odd-or-even="odd" />
    <fo:conditional-page-master-reference
     master-name="without_optical_mark"
     odd-or-even="even" />
   </fo:repeatable-page-master-alternatives>
  </fo:page-sequence-master>



Look at pagination\franklin_2pageseqs.fo  for  an example
seshadri





  ----- Original Message ----- 
  From: Phuong Tran 
  To: 'fop-dev@xml.apache.org' 
  Sent: Saturday, March 17, 2001 1:57 AM
  Subject: FOP 0.15 - Using XSL:FO style sheet, can I detect which page I am on?


  Hi, 

  I'm working on a report which has optical marks on its left margin.  The optical marks appear or disappear depending on which page they are on.  For this I need 2 variables: one is for the current page and the other is for the last page.  I can use fo:page-number and fo:page-number-citation to display "page X of Y" but when I do this, I failed:

  <xsl:variable name="curent_page"><fo:page-number/></xsl_variable> 
  <xsl:variable name="last_page"><fo:page-number-citation ref-id="endofdoc"></xsl:variable> 

  <xsl:if test="$current_page = $last_page"> 
    <fo:inline>Display the 3rd optical mark</fo:inline> 
  </xsl:if> 

  The variables current_page and last_page always have value of NULL and that was why I failed in my xsl:if statement. 

  I had read your discussion on the archived Apache Mailing List with the topic "Which page I am on?" and found the answer provided by  Sebastian Rahtz to Ulrich Mayring's question:

  "--start quote-- 
  Ulrich Mayring writes: 

   > can I find out in my XSL=>FO stylesheet which page I am currently on? 

  You can't. This is a fundamental `feature' of the whole DSSSL and XSL 
  FO model, dissociating page markup instructions from the final 
  rendered pages. Two XSLFO engines are not mandated to make the same 
  page breaks from the same input. 
  --end-quote--" 

  Could you please confirm that this is indeed the case, i.e. that we can't detect the current page or checking whether the current page is the last page in the XSL:FO stylesheet?  If this is the case, do you have any suggestion on how to work around this limitation?  Should we directly manipulate the FO tree generated by Xerces by putting optical marks into the FO tree before sending it forward to FOP for PDF rendering?  We're currently using FOP 0.15 (Cocoon 1.8.2).

  I really appreciate your help on this! 
  Phuong.