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.
> Date: Mon, 5 Oct 2015 16:08:58 +0200 > From: email@example.com > To: firstname.lastname@example.org > Subject: Re: Cross references > > Hi, > > On Mon, 5 Oct 2015 13:16:35 +0000 > Franz de Copenhague <email@example.com> 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: firstname.lastname@example.org > For additional commands, e-mail: email@example.com >