Hi Brent,
Actually, I am doing that too, for the TOC and the Navigation pane (document 
structure).
I will follow the same approach, I must know in advance the bookmark and 
bookmark content to simulate what MS Word does with a REF field.
Thanks,Juande

From: [email protected]
To: [email protected]
Subject: RE: Cross references
Date: Mon, 5 Oct 2015 15:55:43 +0000









I too write FO directly rather than through XSLT because the data I receive is 
generally a CSV and the production of the pdf documents I generate includes some
 extensive logical rules about which flow and which block to use.  
 
I have implemented references in some of my pdf documents for the table of 
contents or and for links to the appropriate page in the document using either 
of the
 following methods:
 
For my pdf document to include bookmarks in the document structure I use the 
bookmark method
<fo:bookmark internal-destination='page_id_100_body'>
 
For regular links within the text I use the basic link
<fo:basic-link internal-destination='page_id_100_body'>
 
Of course, in either case the destination needs to be the unique ID of an 
object in the document.  In my case I do this on the flow for the specified 
page:
<fo:flow flow-name='xsl-region-body' id='page_100_body'>

 
But I suppose you could put the id on any object in the document.  You will 
need to know what that id is (or will be) before actually writing the fo file.
 
 

Brent Stratford
Chief Information Officer
Dixie Graphics Inc.
w-678.607.4264
m-845.629.0081
 


 


From: Franz de Copenhague [mailto:[email protected]]


Sent: Monday, October 05, 2015 10:40 AM

To: [email protected]

Subject: RE: Cross references


 

Thomas,

 


Thank for the explanation about using XSLT and yes, I am writing FO out 
directly. I am trying to avoid XSLT at all, because of the low performance and 
memory consume of XSLT transformations.


 


I can give you more details off-list about my project.


 


Thank you,


Franz.


 


 


 


 

> Date: Mon, 5 Oct 2015 16:08:58 +0200

> From: [email protected]

> To: [email protected]

> Subject: Re: Cross references

> 

> Hi,

> 

> On Mon, 5 Oct 2015 13:16:35 +0000

> Franz de Copenhague <[email protected]> wrote:

> 

> > Thank you for the information. I am writing XML directly without any

> > XSLT transformation.

> 

> Just to be clear: you write the FO *manually*? Without any input XML?

> 

> 

> > Based on your comments, My application must know

> > in advance the content of the fo:block target in order to populate

> > the cross reference (aka basic-link) with the target content.

> 

> Yes, your application has to retrieve the target element somehow.

> However, I 

> 

> In case you would use XSLT, here is the general approach:

> 

> I don't know your XML input, but I guess, it has some kind of id

> attribute which is unique. With xsl:key you can create a kind of array

> of all ids in your document:

> 

> <xsl:key name="id" match="*" use="@id"/>

> 

> Of course, you need an element that is used for cross references. Let's

> play this example with DocBook's <xref/> element and its linkend

> attribute. For example, in your input XML, you could point to somewhere

> else in your document like this:

> 

> <xref linkend="intro"/>

> 

> In the xref-template, to retrieve the target element is simply an

> one-liner:

> 

> <xsl:template match="xref">

> <xsl:variable name="target" select="key('id', @linkend)"/>

> <!-- ... --->

> 

> That will give you the element node where the <xref/> is pointing to.

> 

> Depending on how your target element is structured, it is probably not

> difficult to extract a title or any other relevant information that you

> need to insert its content as text into <fo:basic-link>.

> 

> 

> > I understand that it is hard to implement by FOP because the target

> > with the content could be in any part of the fo:flow, inclusive the

> > target can be in a different page-sequence.

> 

> Yes. There are issues that are better delegated to FO and its formatter.

> On the other hand, with XSLT you can use templates and the right XPath

> to transform your input XML into the correct FO representation.

> 

> 

> Hope that helps. :)

> 

> -- 

> Gruß/Regards,

> Thomas Schraitle

> 

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: 
[email protected]

> For additional commands, e-mail: 
[email protected]

> 



                                          

Reply via email to