On 01 Dec 2008, at 22:21, Sebastien wrote:

What about a mechanism which squeeze all the unresolved page-number- citation dummy space at the end of the processing ? I didn't really look into FOP's code so it might very well be a stupid idea and/or an impossible thing to do... I just think that since FOP is obviously able to replace a forward reference when it encounters it, it might be able to replace/squeeze an unresolved reference as well. But again, i'm surely missing some internal details...

Not stupid, and perhaps not even impossible... Only far from trivial, I'm afraid. The problem from FOP's point-of-view, as I indicated, is that it can never guarantee whether a link will be resolved yes or no. FOP can only judge that accurately if and when the document is completely processed. At that point, we could still decide to skip / rendering/ for the corresponding dummy areas, but in case of justified alignment, for example, you could then end up with some lines that are not entirely filled. An issue that arises for some cases currently, where the actual page-number is smaller than the reserved space, and the breaks were computed based on the space for "MMM".

<snip />
Actually i named my FO ids with a convenient name which is "[chapter]_[number]" (eg: actions_52) so i might be able to get a list of chapters which are generated from my application. Then i would split the ref-id with the '_' delimiter and compare the first part with the list of generated chapters and decide whether to add the page-number-citation or not... But considering all the links in the document, doing a string split + an array search + a test for each and every one of them seems like a real pain and i would hate to do that.

It depends. If the chapter name and number exist somewhere as an attribute value in the source file, you could build a key map like:

<xsl:key name="chapter-exists" match="someElement" use="concat(@name,'_',@number)" />

and correspondingly:

<xsl:if test="chapter-exists($someRefId)">
  <fo:page-number-citation ref-id="$someRefId" />
</xsl:if>

No need for all the complicated stuff you describe above, but that's obviously only in case the chapter-reference can be easily extracted from the source...

BUT: if the document is sufficiently large, then this could have a significant impact on the duration of the XSL transform phase.

If all else fails, you could still pre-process the FO document, by applying a second transformation before sending it to FOP... This would basically be an identity transform, with only a matching template for fo:page-number-citation, which checks in a similar manner as described above, whether the value for the ref-id attribute is used as an id by any other element node.

HTH!

Cheers

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to