| From | Sent On | Attachments |
|---|---|---|
| Tomek Kaczanowski | Sep 26, 2011 12:51 pm | |
| Bob Stayton | Sep 27, 2011 3:02 am | |
| Tomek Kaczanowski | Sep 27, 2011 2:31 pm | |
| Bob Stayton | Sep 27, 2011 3:03 pm | |
| Tomek Kaczanowski | Sep 29, 2011 4:34 am |
| Subject: | [docbook-apps] changing how xrefs to listings are rendered in PDF | |
|---|---|---|
| From: | Tomek Kaczanowski (kacz...@gmail.com) | |
| Date: | Sep 26, 2011 12:51:08 pm | |
| List: | org.oasis-open.lists.docbook-apps | |
Hi All,
I'm writing a book using Docbook and have an issue with how references to listings are rendered in PDF version.
For example, my docbook file contains the following fragment:
<simpara>Blah blah blah as presented on listing <xref linkend="listing_shortest_test"/>.</simpara>
<formalpara id="listing_shortest_test"> <title>One-Liner Test</title> <para> <programlisting language="java" linenumbering="unnumbered"> // some cool code here </programlisting> </para> </formalpara>
In PDF version (generated with fop) xhref link to the listing is rendered as:
"Blah blah blah as presented on listing One-Liner Test."
I would like to look it differently, i.e. like this:
"Blah blah blah as presented on listing 3.1"
I have achieved similar thing with tables and figures (as discussed here http://is.gd/wAInBB) by tweaking the docbook-xsl/fo.xsl like this: <xsl:param name="local.l10n.xml" select="document('')"/> <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> <l:l10n language="en"> <l:context name="xref-number-and-title"> <l:template name="table" text="Table %n"/> </l:context> </l:l10n> </l:i18n>
I have tried to do the same with listings, using various options (well, I was just shooting in the dark, I know...):
<l:context name="xref-number-and-title"> <l:template name="listing" text="Listing %n"/> <l:template name="example" text="Listing %n"/> <l:template name="formalpara" text="Listing %n"/> </l:context>
but without any success. I have also tried to change value of xref.with.number.and.title but this seems to be broken (nothing happens).
I read http://www.sagehill.net/docbookxsl/CustomGentext.html and a lot of other docbook xsl information, but I still do not know how to do this.
Could you please help?
P.S. To give you the full picture, I'm using AsciiDoc, but I do not think it matters. At some point I got a valid docbook document which is converted to PDF and this is the part I'm struggling with.
-- Regards, Tomek Kaczanowski http://kaczanowscy.pl/tomek





