Re: Finding # of pages in document?

Subject: Re: Finding # of pages in document?
From: Oisin McGuinness <oisin@xxxxxxxx>
Date: Tue, 15 Feb 2000 12:07:40 -0500
Nicholas Weininger said:
> The motivation here is that I'm trying to get
> a footer for RTF output that does "Page x of y" where y is the total
> number of pages in the document.

A trick that has worked for me is that if you have someway to identify
an element which will almost certainly end up on the last page of a
document (not guaranteed for very long paragraphs), then do something like
this (excerpt from a quiz.dsl, which handles a quiz dtd, root element named
"quiz", elements "q" and "a"):

;; Define a mode for use in header 
(mode page-number
        (default (current-node-page-number-sosofo)))
;; Implementation from DSSSL digest #175. Compare standard page 136.
(define (node-list-last nl)
        (node-list-first (node-list-reverse nl)))

(element QUIZ
    (make simple-page-sequence
         (make sequence
               font-posture: 'italic
               (process-first-descendant "TITLE"))
         (make sequence
               font-posture: 'italic
               (literal "Page ")
               (literal " of ")
               (with-mode page-number
                                (descendants (current-node))
       input-whitespace-treatment: 'collapse
       quadding: 'justify

This assumes the last Q element in the document is likely to be on the last page....

Oisin McGuinness

Sumitomo Bank Capital Markets
277 Park Avenue
New York NY 10172

(212)-224-4913, email: oisin@xxxxxxxx

 DSSSList info and archive:

Current Thread