Cross references

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross references

Franz de Copenhague
How can I do a cross reference? Inside of a <fo:flow> with the content of a
<fo:inline> with a particular id.

I am looking for a similar functionality to <fo:retrieve-marker> and
<fo:marker> inside of a <fo:static-content>

Thanks,
Franz

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Cross references

Thomas Schraitle
Hi Franz,

On Mon, 5 Oct 2015 07:15:18 -0400
Franz de Copenhague <[hidden email]> wrote:

> How can I do a cross reference? Inside of a <fo:flow> with the
> content of a <fo:inline> with a particular id.
>
> I am looking for a similar functionality to <fo:retrieve-marker> and
> <fo:marker> inside of a <fo:static-content>

I fear there is no similar functionality for cross references like you
have in mind. However, have you tried fo:basic-link? Something like
this:

  <fo:block id="intro">Introduction</fo:block>
  ...
  <fo:block>
    See <fo:basic-link
    internal-destination="intro">Introduction</fo:basic-link>.
  </fo:block>

You need to retrieve the content of fo:basic-link by yourself (probably
through a XSLT transformation).

Does that help?

--
Gruß/Regards,
    Thomas Schraitle

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Cross references

Franz de Copenhague
Hi Thomas,

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

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.

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.

Thanks,
Juande

> Date: Mon, 5 Oct 2015 13:28:21 +0200

> From: [hidden email]
> To: [hidden email]
> Subject: Re: Cross references
>
> Hi Franz,
>
> On Mon, 5 Oct 2015 07:15:18 -0400
> Franz de Copenhague <[hidden email]> wrote:
>
> > How can I do a cross reference? Inside of a <fo:flow> with the
> > content of a <fo:inline> with a particular id.
> >
> > I am looking for a similar functionality to <fo:retrieve-marker> and
> > <fo:marker> inside of a <fo:static-content>
>
> I fear there is no similar functionality for cross references like you
> have in mind. However, have you tried fo:basic-link? Something like
> this:
>
> <fo:block id="intro">Introduction</fo:block>
> ...
> <fo:block>
> See <fo:basic-link
> internal-destination="intro">Introduction</fo:basic-link>.
> </fo:block>
>
> You need to retrieve the content of fo:basic-link by yourself (probably
> through a XSLT transformation).
>
> Does that help?
>
> --
> Gruß/Regards,
> Thomas Schraitle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: Cross references

Thomas Schraitle
Hi,

On Mon, 5 Oct 2015 13:16:35 +0000
Franz de Copenhague <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Cross references

Tom Morrison
In reply to this post by Franz de Copenhague

Dear Juande,

 

You say, “I am writing XML directly without any XSLT transformation.” 

 

This issue would be trivial if you were to use the XSLT process first, before the actual FOP rendering step. 

 

While Thomas has already given some hints (while I am typing this message), normally XSLT issues are not answered on this list.  However, I answer XSLT questions (for FOP and other uses) quite extensively on the following forum (free registration required):

http://www.tek-tips.com/threadminder.cfm?pid=426

 

I invite you to pose the question on that forum, where I can answer it in as much depth as you require.

 

Best regards,

Tom Morrison

Hill Country Software

 

 

From: Franz de Copenhague [mailto:[hidden email]]
Sent: Monday, October 05, 2015 8:17 AM
To: [hidden email]
Subject: RE: Cross references

 

Hi Thomas,

 

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

 

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.

 

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.

 

Thanks,

Juande

> Date: Mon, 5 Oct 2015 13:28:21 +0200


> From: [hidden email]
> To:
[hidden email]
> Subject: Re: Cross references
>
> Hi Franz,
>
> On Mon, 5 Oct 2015 07:15:18 -0400
> Franz de Copenhague <
[hidden email]> wrote:
>
> > How can I do a cross reference? Inside of a <fo:flow> with the
> > content of a <fo:inline> with a particular id.
> >
> > I am looking for a similar functionality to <fo:retrieve-marker> and
> > <fo:marker> inside of a <fo:static-content>
>
> I fear there is no similar functionality for cross references like you
> have in mind. However, have you tried fo:basic-link? Something like
> this:
>
> <fo:block id="intro">Introduction</fo:block>
> ...
> <fo:block>
> See <fo:basic-link
> internal-destination="intro">Introduction</fo:basic-link>.
> </fo:block>
>
> You need to retrieve the content of fo:basic-link by yourself (probably
> through a XSLT transformation).
>
> Does that help?
>
> --
> Gruß/Regards,
> Thomas Schraitle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
[hidden email]
> For additional commands, e-mail:
[hidden email]
>

Reply | Threaded
Open this post in threaded view
|

RE: Cross references

Franz de Copenhague
In reply to this post by Thomas Schraitle
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: [hidden email]
> To: [hidden email]
> Subject: Re: Cross references
>
> Hi,
>
> On Mon, 5 Oct 2015 13:16:35 +0000
> Franz de Copenhague <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

RE: Cross references

Brent Stratford

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

 

image001 (3)

 

From: Franz de Copenhague [mailto:[hidden email]]
Sent: Monday, October 05, 2015 10:40 AM
To: [hidden email]
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: [hidden email]
> To: [hidden email]
> Subject: Re: Cross references
>
> Hi,
>
> On Mon, 5 Oct 2015 13:16:35 +0000
> Franz de Copenhague <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

RE: Cross references

Franz de Copenhague
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: [hidden email]
To: [hidden email]
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

 

image001 (3)

 

From: Franz de Copenhague [mailto:[hidden email]]
Sent: Monday, October 05, 2015 10:40 AM
To: [hidden email]
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: [hidden email]
> To: [hidden email]
> Subject: Re: Cross references
>
> Hi,
>
> On Mon, 5 Oct 2015 13:16:35 +0000
> Franz de Copenhague <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>