You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Brian Trezise <br...@intellidata.net> on 2009/08/15 01:00:37 UTC

Auto-generate table of contents

Can somebody point me to a good (and well explained) example of using
XSL/FOP to auto-create a table of contents? I've spent the last couple hours
looking for information on this but it's not making sense.

 

Here's a sample of my xml:
<?xml version="1.0" encoding="UTF-8"?>

<catalog>

  <intellispec>

    <pn>C0805C101J1GACTU</pn>

    <aliases>

      <alias>C0805C101J1GAC7800</alias>

    </aliases>

    <mfg>KEMET</mfg>

    <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>

    <copyright-year>2006-2009</copyright-year>

      . . .

  </intellispec>

  <intellispec>

    <pn>T491B107K010AT</pn>

    <mfg>KEMET</mfg>

    <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>

    <copyright-year>2006-2009</copyright-year>

      . . .

  </intellispec>

      . . .

 

I would like to generate a table of contents page using the text of the
catalog/intellispec/pn and mfg tags (the table of contents would render more
or less as follows:

C0805C101J1GACTU (KEMET) ..................... 1

T491B107K010AT (KEMET) ....................... 2

      . . .

(Each item would also have an internal hyperlink to the page number in the
pdf where the associated datasheet is located)

 

I have attached the xsl file I'm working on; the table of contents is
intended to go in the first <fo: page-sequence> tag body.

 

Thanks in advance for the assistance,

 

-----------------------------

Brian Trezise

IntelliData, Inc.

Staff Software Engineer

brian.trezise@intellidata.net

t: 720.524.4864

m: 303.809.9782

 


Re: Auto-generate table of contents

Posted by Andreas Delmelle <an...@telenet.be>.
On 20 Aug 2009, at 16:57, Brian Trezise wrote:

Hi Brian

> That appears to be for creating links inside the document that point  
> to an
> external document, no?

Correct, but as I mentioned, I don't think you need to do anything  
special for referring to a specific 'page' in the target document  
(other than appending 'page=xx' to the URI of the external-link in the  
source document)

> I'm wanting to create a hyperlink from an external
> excel file that opens to a particular point (page, named  
> destination, it
> doesn't matter) inside the pdf document I'm generating.  Is this  
> possible?

That's another matter. If that does not work properly, it could mean  
that Excel does not correctly pass the URL parameters to the PDF  
viewer application, and the bug should be filed with MS. Nothing we  
can do on our end to resolve that, unfortunately...

Again: to simply refer to specific 'pages' in the target PDF, nothing  
special needs to happen for the source PDF.

> I'm not having much luck.  Perhaps if I attach the xsl it'll help?   
> (I want
> an externally-accessible bookmark of some sort for each page created  
> with
> the xsl:for-each starting on line 162)


The supplied link should be of help, but only if you do not need to  
refer to predefined 'anchors' (not 'pages') in the target document.


Regards,

Andreas Delmelle
mailto:andreas.delmelle.AT.telenet.be
jabber: mandreas@jabber.org
skype: adlm0608

---


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Auto-generate table of contents

Posted by Brian Trezise <br...@intellidata.net>.
That appears to be for creating links inside the document that point to an
external document, no? I'm wanting to create a hyperlink from an external
excel file that opens to a particular point (page, named destination, it
doesn't matter) inside the pdf document I'm generating.  Is this possible?
I'm not having much luck.  Perhaps if I attach the xsl it'll help?  (I want
an externally-accessible bookmark of some sort for each page created with
the xsl:for-each starting on line 162)

Thanks for the help,
~Brian

-----------------------------
Brian Trezise
IntelliData, Inc.
Staff Software Engineer
brian.trezise@intellidata.net
t: 720.524.4864
m: 303.809.9782

-----Original Message-----
From: Andreas Delmelle [mailto:andreas.delmelle@telenet.be] 
Sent: Wednesday, August 19, 2009 14:32
To: fop-users@xmlgraphics.apache.org
Subject: Re: Auto-generate table of contents

On 19 Aug 2009, at 22:28, Andreas Delmelle wrote:

> On 19 Aug 2009, at 22:22, Brian Trezise wrote:
>
> Hi Brian
>
>> How do you put bookmarks or page markings into the pdf so that you  
>> can use
>> (hyperlink)#page=XXX to open the document to a specific page?
>
> See:
http://xmlgraphics.apache.org/fop/0.95/extensions.html#named-destinations

Just noticed: to open the document at a specific /page/, you should be  
able to do that using a regular fo:external-link, without having to do  
anything special in the target FO document. Anchors/named destinations  
are useful if you can figure out an identifier for the part you're  
referring to, but have no idea on which page it resides (because maybe  
the document has not been rendered yet?).

Regards


Andreas Delmelle
mailto:andreas.delmelle.AT.telenet.be
jabber: mandreas@jabber.org
skype: adlm0608

---



Re: Auto-generate table of contents

Posted by Andreas Delmelle <an...@telenet.be>.
On 19 Aug 2009, at 22:28, Andreas Delmelle wrote:

> On 19 Aug 2009, at 22:22, Brian Trezise wrote:
>
> Hi Brian
>
>> How do you put bookmarks or page markings into the pdf so that you  
>> can use
>> (hyperlink)#page=XXX to open the document to a specific page?
>
> See: http://xmlgraphics.apache.org/fop/0.95/extensions.html#named-destinations

Just noticed: to open the document at a specific /page/, you should be  
able to do that using a regular fo:external-link, without having to do  
anything special in the target FO document. Anchors/named destinations  
are useful if you can figure out an identifier for the part you're  
referring to, but have no idea on which page it resides (because maybe  
the document has not been rendered yet?).

Regards


Andreas Delmelle
mailto:andreas.delmelle.AT.telenet.be
jabber: mandreas@jabber.org
skype: adlm0608

---


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Auto-generate table of contents

Posted by Andreas Delmelle <an...@telenet.be>.
On 19 Aug 2009, at 22:22, Brian Trezise wrote:

Hi Brian

> How do you put bookmarks or page markings into the pdf so that you  
> can use
> (hyperlink)#page=XXX to open the document to a specific page?

See: http://xmlgraphics.apache.org/fop/0.95/extensions.html#named-destinations

HTH!

Andreas


Andreas Delmelle
mailto:andreas.delmelle.AT.telenet.be
jabber: mandreas@jabber.org
skype: adlm0608

---


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Auto-generate table of contents

Posted by Brian Trezise <br...@intellidata.net>.
How do you put bookmarks or page markings into the pdf so that you can use
(hyperlink)#page=XXX to open the document to a specific page?

-----------------------------
Brian Trezise
IntelliData, Inc.
Staff Software Engineer
brian.trezise@intellidata.net
t: 720.524.4864
m: 303.809.9782


-----Original Message-----
From: Sergiu Dumitriu [mailto:sergiu@xwiki.com] 
Sent: Saturday, August 15, 2009 4:11
To: fop-users@xmlgraphics.apache.org
Subject: Re: Auto-generate table of contents

Brian Trezise wrote:
> Can somebody point me to a good (and well explained) example of using 
> XSL/FOP to auto-create a table of contents? I've spent the last couple 
> hours looking for information on this but it's not making sense.
> 
>  
> 
> Here's a sample of my xml:
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <catalog>
> 
>   <intellispec>
> 
>     <pn>C0805C101J1GACTU</pn>
> 
>     <aliases>
> 
>       <alias>C0805C101J1GAC7800</alias>
> 
>     </aliases>
> 
>     <mfg>KEMET</mfg>
> 
>     <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>
> 
>     <copyright-year>2006-2009</copyright-year>
> 
>       . . .
> 
>   </intellispec>
> 
>   <intellispec>
> 
>     <pn>T491B107K010AT</pn>
> 
>     <mfg>KEMET</mfg>
> 
>     <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>
> 
>     <copyright-year>2006-2009</copyright-year>
> 
>       . . .
> 
>   </intellispec>
> 
>       . . .
> 
>  
> 
> I would like to generate a table of contents page using the text of the 
> catalog/intellispec/pn and mfg tags (the table of contents would render 
> more or less as follows:
> 
> C0805C101J1GACTU (KEMET) ..................... 1
> 
> T491B107K010AT (KEMET) ....................... 2
> 
>       . . .
> 
> (Each item would also have an internal hyperlink to the page number in 
> the pdf where the associated datasheet is located)

Perhaps this can help as an example: 
http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/r
esources/xhtml2fo.xsl

Look for <!-- Table of content --> to find the code that generates the 
table of contents, and then search for
<xsl:template match="html:h1" mode="transform">
to see how to generate the link target.


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Auto-generate table of contents

Posted by Brian Trezise <br...@intellidata.net>.
Thanks Sergiu, I got it to work :)

~Brian

-----------------------------
Brian Trezise
IntelliData, Inc.
Staff Software Engineer
brian.trezise@intellidata.net
t: 720.524.4864
m: 303.809.9782

-----Original Message-----
From: Sergiu Dumitriu [mailto:sergiu@xwiki.com] 
Sent: Saturday, August 15, 2009 4:11
To: fop-users@xmlgraphics.apache.org
Subject: Re: Auto-generate table of contents

Brian Trezise wrote:
> Can somebody point me to a good (and well explained) example of using 
> XSL/FOP to auto-create a table of contents? I've spent the last couple 
> hours looking for information on this but it's not making sense.
> 
>  
> 
> Here's a sample of my xml:
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <catalog>
> 
>   <intellispec>
> 
>     <pn>C0805C101J1GACTU</pn>
> 
>     <aliases>
> 
>       <alias>C0805C101J1GAC7800</alias>
> 
>     </aliases>
> 
>     <mfg>KEMET</mfg>
> 
>     <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>
> 
>     <copyright-year>2006-2009</copyright-year>
> 
>       . . .
> 
>   </intellispec>
> 
>   <intellispec>
> 
>     <pn>T491B107K010AT</pn>
> 
>     <mfg>KEMET</mfg>
> 
>     <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>
> 
>     <copyright-year>2006-2009</copyright-year>
> 
>       . . .
> 
>   </intellispec>
> 
>       . . .
> 
>  
> 
> I would like to generate a table of contents page using the text of the 
> catalog/intellispec/pn and mfg tags (the table of contents would render 
> more or less as follows:
> 
> C0805C101J1GACTU (KEMET) ..................... 1
> 
> T491B107K010AT (KEMET) ....................... 2
> 
>       . . .
> 
> (Each item would also have an internal hyperlink to the page number in 
> the pdf where the associated datasheet is located)

Perhaps this can help as an example: 
http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/r
esources/xhtml2fo.xsl

Look for <!-- Table of content --> to find the code that generates the 
table of contents, and then search for
<xsl:template match="html:h1" mode="transform">
to see how to generate the link target.


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Auto-generate table of contents

Posted by Sergiu Dumitriu <se...@xwiki.com>.
Brian Trezise wrote:
> Can somebody point me to a good (and well explained) example of using 
> XSL/FOP to auto-create a table of contents? I’ve spent the last couple 
> hours looking for information on this but it’s not making sense.
> 
>  
> 
> Here’s a sample of my xml:
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <catalog>
> 
>   <intellispec>
> 
>     <pn>C0805C101J1GACTU</pn>
> 
>     <aliases>
> 
>       <alias>C0805C101J1GAC7800</alias>
> 
>     </aliases>
> 
>     <mfg>KEMET</mfg>
> 
>     <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>
> 
>     <copyright-year>2006-2009</copyright-year>
> 
>       . . .
> 
>   </intellispec>
> 
>   <intellispec>
> 
>     <pn>T491B107K010AT</pn>
> 
>     <mfg>KEMET</mfg>
> 
>     <svg-path>C:/svn/code/IntelliSpec/images/</svg-path>
> 
>     <copyright-year>2006-2009</copyright-year>
> 
>       . . .
> 
>   </intellispec>
> 
>       . . .
> 
>  
> 
> I would like to generate a table of contents page using the text of the 
> catalog/intellispec/pn and mfg tags (the table of contents would render 
> more or less as follows:
> 
> C0805C101J1GACTU (KEMET) ..................... 1
> 
> T491B107K010AT (KEMET) ....................... 2
> 
>       . . .
> 
> (Each item would also have an internal hyperlink to the page number in 
> the pdf where the associated datasheet is located)

Perhaps this can help as an example: 
http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/resources/xhtml2fo.xsl

Look for <!-- Table of content --> to find the code that generates the 
table of contents, and then search for
<xsl:template match="html:h1" mode="transform">
to see how to generate the link target.


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org