xsl-list
[Top] [All Lists]

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

2006-05-18 21:49:08
At 2006-05-18 16:22 +0200, Alexander(_dot_)RACHER(_at_)geos(_dot_)biz 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)?

"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"
force-page-count="no-force">
<fo:static-content flow-name="xsl-region-before">
[...]
<fo:blockalign="end">
<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>
[...]
<fo:block id="last-page"/>

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

</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>

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(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>