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 vi...@gerling.de on 2001/09/19 15:51:20 UTC

Formatting in addiction to the total page number

Hi, 

perhaps someone have a response to my problem:

On top of the first page I would like to make a warning output (e.g. "This
document contains 10 pages!"), but only if the document has more than one
page. If the document has exactly one page, no warning should appear. Is
this possible ?

I have try something like this:

    <xsl:param name="PAGES"><fo:page-number-citation
ref-id="end-of-document"/></xsl:param>

    <xsl:if test="$PAGES>1">
    <!-- or <xsl:if test="$PAGES &gt; 1"> , but no more success --> 
        <fo:block>
            This document contains <fo:page-number-citation
ref-id="end-of-document"/> pages!
        </fo:block>
    </xsl:if>

    [... ]

    <fo:block id="end-of-document" />

but this does't work.

Greetings
Viktor Keimes



---------------------------------------------------------------------
This message is intended for the addressee or its representative only. Any
form of unauthorized use, publication, reproduction, copying or disclosure
of the content of this e-mail is not permitted. If you are not the intended
recipient of this e-mail message and its contents, please notify the sender
immediately and delete this message and all its attachments subsequently.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Formatting in addiction to the total page number

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Wed, 19 Sep 2001 17:31:43 Keiron Liddle wrote:
> 
> This is possible with a bit of inovation.
> Thanks to the support of markers and svg.
> The only problem is that the message will appear on all pages except the
> last page, unless someone knows how to solve this.

Sorry about the double message.

I have the answer to my problem.
The solution (of course) is to use a marker at the top of the flow for the
warning message with retrieve-position="first-starting-within-page". So
that if the start and end of the flow are on the same page then you see no
message. If the end is on a different page then you see the message only on
the first page.

At least that is one way to do it.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Formatting in addiction to the total page number

Posted by Keiron Liddle <ke...@aftexsw.com>.
This is possible with a bit of inovation.
Thanks to the support of markers and svg.
The only problem is that the message will appear on all pages except the
last page, unless someone knows how to solve this.

The idea is to put the message in the static area and also have a marker
that is placed in the same position as the message. The marker contents
simply has an svg rect that is white so it hides the message.

Find the examples below.

Also note that I noticed a bug with the markers, the first problem is that
it doesn't like it if there is white space before the marker (so it thinks
it is not the first child in the block) and the second problem is that an
npe results from the first error due to the log being null, my fault.

--------------
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master
  margin-right="1.5cm"
  margin-left="1.5cm"
  margin-bottom="2cm"
  margin-top="1cm"
  page-width="21cm"
  page-height="29.7cm"
  master-name="first">
      <fo:region-before extent="1cm"/>
      <fo:region-body margin-top="1cm"/>
      <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>

  <fo:page-sequence master-name="first">
    <fo:static-content flow-name="xsl-region-before">
<fo:block-container height="1cm" width="15cm" top="0cm" left="0cm"
position="absolute">
    <fo:block>
WARNING THIS IS NOT THE LAST PAGE  <fo:page-number-citation
ref-id="end-of-document"/>
      </fo:block>
</fo:block-container>
<fo:block-container height="1cm" width="15cm" top="0cm" left="0cm"
position="absolute">
    <fo:block>
      <fo:retrieve-marker retrieve-class-name="term"
      retrieve-boundary="page"
      retrieve-position="last-ending-within-page"/>
      </fo:block>
</fo:block-container>
    </fo:static-content>

    <fo:static-content flow-name="xsl-region-after">
    <fo:block text-align="start"
      font-size="10pt" font-family="serif" line-height="1em + 2pt">
      Page (<fo:page-number/> / <fo:page-number-citation
ref-id="end-of-document"/>)
      </fo:block>
    </fo:static-content>

    <fo:flow flow-name="xsl-region-body">

  <fo:block text-align="start" font-size="12pt" font-family="sans-serif">
flow stuff
  </fo:block>

<fo:block id="end-of-document"><fo:marker
    marker-class-name="term">
<fo:instream-foreign-object>
<svg xmlns="http://www.w3.org/2000/svg" width="15cm" height="1cm"
xml:space="preserve">
     <rect style="fill:white;stroke:white" x="0" y="0" width="15cm"
height="1cm"/>
</svg>
</fo:instream-foreign-object>
</fo:marker>
  </fo:block>

    </fo:flow>
  </fo:page-sequence>
</fo:root>


----------------

add this after first block in flow to get two pages

  <fo:block break-before="page" text-align="start" font-size="12pt"
font-family="sans-serif">
flow stuff
  </fo:block>



On Wed, 19 Sep 2001 15:51:20 viktor.keimes@gerling.de wrote:
> Hi, 
> 
> perhaps someone have a response to my problem:
> 
> On top of the first page I would like to make a warning output (e.g.
> "This
> document contains 10 pages!"), but only if the document has more than one
> page. If the document has exactly one page, no warning should appear. Is
> this possible ?
> 
> I have try something like this:
> 
>     <xsl:param name="PAGES"><fo:page-number-citation
> ref-id="end-of-document"/></xsl:param>
> 
>     <xsl:if test="$PAGES>1">
>     <!-- or <xsl:if test="$PAGES &gt; 1"> , but no more success --> 
>         <fo:block>
>             This document contains <fo:page-number-citation
> ref-id="end-of-document"/> pages!
>         </fo:block>
>     </xsl:if>
> 
>     [... ]
> 
>     <fo:block id="end-of-document" />
> 
> but this does't work.
> 
> Greetings
> Viktor Keimes

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Formatting in addiction to the total page number

Posted by Keiron Liddle <ke...@aftexsw.com>.
This is possible with a bit of inovation.
Thanks to the support of markers and svg.
The only problem is that the message will appear on all pages except the
last page, unless someone knows how to solve this.

The idea is to put the message in the static area and also have a marker
that is placed in the same position as the message. The marker contents
simply has an svg rect that is white so it hides the message.

Find the examples attached.

Also note that I noticed a bug with the markers, the first problem is that
it doesn't like it if there is white space before the marker (so it thinks
it is not the first child in the block) and the second problem is that an
npe results from the first error due to the log being null, my fault.



On Wed, 19 Sep 2001 15:51:20 viktor.keimes@gerling.de wrote:
> Hi, 
> 
> perhaps someone have a response to my problem:
> 
> On top of the first page I would like to make a warning output (e.g.
> "This
> document contains 10 pages!"), but only if the document has more than one
> page. If the document has exactly one page, no warning should appear. Is
> this possible ?
> 
> I have try something like this:
> 
>     <xsl:param name="PAGES"><fo:page-number-citation
> ref-id="end-of-document"/></xsl:param>
> 
>     <xsl:if test="$PAGES>1">
>     <!-- or <xsl:if test="$PAGES &gt; 1"> , but no more success --> 
>         <fo:block>
>             This document contains <fo:page-number-citation
> ref-id="end-of-document"/> pages!
>         </fo:block>
>     </xsl:if>
> 
>     [... ]
> 
>     <fo:block id="end-of-document" />
> 
> but this does't work.
> 
> Greetings
> Viktor Keimes
> 
> 
> 
> ---------------------------------------------------------------------
> This message is intended for the addressee or its representative only.
> Any
> form of unauthorized use, publication, reproduction, copying or
> disclosure
> of the content of this e-mail is not permitted. If you are not the
> intended
> recipient of this e-mail message and its contents, please notify the
> sender
> immediately and delete this message and all its attachments subsequently.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
> 
> 

RE: Formatting in addiction to the total page number

Posted by Alistair Hopkins <al...@berthengron.co.uk>.
This won't work because the xsl: namespace processing happens before
<fo:page-number-citation ref-id="end-of-document"/> gets a value during the
fo: namespace processing, so the variable [sorry parameter] PAGES contains
the literal string.

You could show the warning on all pages except the front page by using
different static areas.

I can't think of any other way.

Al

-----Original Message-----
From: viktor.keimes@gerling.de [mailto:viktor.keimes@gerling.de]
Sent: Wednesday, September 19, 2001 2:51 PM
To: fop-dev@xml.apache.org
Subject: Formatting in addiction to the total page number


Hi,

perhaps someone have a response to my problem:

On top of the first page I would like to make a warning output (e.g. "This
document contains 10 pages!"), but only if the document has more than one
page. If the document has exactly one page, no warning should appear. Is
this possible ?

I have try something like this:

    <xsl:param name="PAGES"><fo:page-number-citation
ref-id="end-of-document"/></xsl:param>

    <xsl:if test="$PAGES>1">
    <!-- or <xsl:if test="$PAGES &gt; 1"> , but no more success -->
        <fo:block>
            This document contains <fo:page-number-citation
ref-id="end-of-document"/> pages!
        </fo:block>
    </xsl:if>

    [... ]

    <fo:block id="end-of-document" />

but this does't work.

Greetings
Viktor Keimes



---------------------------------------------------------------------
This message is intended for the addressee or its representative only. Any
form of unauthorized use, publication, reproduction, copying or disclosure
of the content of this e-mail is not permitted. If you are not the intended
recipient of this e-mail message and its contents, please notify the sender
immediately and delete this message and all its attachments subsequently.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org