Re: [xsl] fo:page-number-citation and dynamic id's

Subject: Re: [xsl] fo:page-number-citation and dynamic id's
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 May 2006 06:48:03 +0200
At 2006-05-18 16:22 +0200, Alexander.RACHER@xxxxxxxx wrote:
is there any possibility in fo to use dynamic id's in xsl / xsl-fo?

I'm not sure what you mean by a "dynamic id".

background of my question:
i need to generate 2 nearly identical (only one fo:block is different =
address --> one document per address) output-docs. so i wrapped a
xsl:for-each around the fo:page-sequence in my stylesheet. works great,
also could reset the page-count in the second document (
initial-page-number="1"). so for an output in pdf with 4 pages per
individual document and 2 adressen/element i get 8 pages, which consist of
2 documents, each correctly page-numbered from 1 to 4.

only one problem came up:
i want to include page-numbers in the footer which look like 'page x of y'
(also to be able to easily distinguish the 2 docs in my output-pdf). as
long as only one document was the output, it worked. but if the whole
fo:page-sequence is parsed more than one time, the solution with <
fo:page-number-citation ref-id="last-page"/> didn't work any more because
of multiple <fo:block id="last-page"/> (FOP-exception: "Property id
"last-page" previously used; id values must be unique in document.").

Right ... the engine will stop at the first it finds.

so my question is: is there any possibility in xsl / xsl-fo to generate
such id's (which, in contrary to the 'generate-id()'-function, can also be

"called"? no.

the concept i have in my mind is, that i generate one id
'last-page' for each //adressen/element , so each partial-output-document
can be page-numbered like 'page x of y'.

You could just use the current node's id as generated by XSLT since that will be unique for each page sequence you produce.

here's the relevant part of my xml:
<xsl:for-each select="//adressen/element">
<fo:page-sequence master-reference="blattA4" initial-page-number="1"
<fo:static-content flow-name="xsl-region-before">
<fo:page-number/> von <fo:page-number-citation ref-id="last-page"/>

Here instead use <fo:page-number-citation ref-id="{generate-id(.)}"/>

<fo:block id="last-page"/>

Here instead use <fo:block id="{generate-id(.)}"/>


any ideas?

I hope this helps.

. . . . . . . . . Ken

Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XSL-FO/XSLT training:    Minneapolis, MN 2006-07-31/08-04
Also for XML/XSLT/XSL-FO/UBL training: Varo,Denmark 06-09-25/10-06
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05
Legal business disclaimers:

Current Thread