On Aug 15, 2006, at 11:27, Jeremias Maerki wrote:
On 15.08.2006 11:17:01 andyrob_24_7 wrote:
Any chance on more details about using the area tree XML format
to determine the page number.
That's non-standard procedure so there's no official documentation.
It's
just a hacky work-around. Just look around in the area tree XML and
you'll figure out what it can provide for you. Maybe one hint I can
give
is to use "id" properties on key elements so you can identify the
elements you look for more easily using XPath. "id" property values
will
end up in "prod-id" attributes in the area tree XML.
To expand a little, very roughly, you'll need an XPath like:
//[EMAIL PROTECTED]'...']/ancestor::pageViewport/@nr (or .../@formatted-nr)
Or, to replace all the page-number-citations in the original document
with their actual values in the area tree:
<xsl:template match="fo:page-number-citation">
<fo:inline>
<!-- copy attributes, then ... -->
<xsl:value-of select="//[EMAIL PROTECTED]()/@ref-id]
/ancestor::pageViewport/@formatted-nr" />
</fo:inline>
</xsl:template>
Note that, for performance reasons, the above is actually not a good
example.
You might prefer to index the nodes by @prod-id using an xsl:key, so
you can retrieve them using the key() function.
I'm presuming you can't do this in one pass?
Nope. You'll need to render the original FO once to the intermediate
format, then 'merge' the result into the original document using a
separate XSL transform, and render the resulting FO to PDF.
The other, less obvious option, is to manipulate the attributes of
the nodes corresponding to the rendered page-number-citations in the
area tree, shifting the text into its desired location... The result
of doing so may, however, not be exactly what you need, but it would
enable you to render off the same area tree, and skip a second pass
through layout.
HTH!
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]