Hi All, I managed to solve my problem thanks to help from Bob Stayton at docbook-apps mailing list (http://thread.gmane.org/ gmane.text.docbook.apps/25312). Here is the full solution - works for both PDF and ePub. Enjoy. :)
1) Create a custom-format.xml file with the following content: <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> <l:l10n language="en"> <!-- TOC title --> <l:gentext key="ListofExamples" text="List of Listings"/> <!-- Title over each listing --> <l:context name="title"> <l:template name="example" text="Listing %n. %t"/> </l:context> <!-- References to Tables, Figures and Listings --> <l:context name="xref-number-and-title"> <l:template name="table" text="Table %n"/> <l:template name="figure" text="Figure %n"/> <l:template name="example" text="Listing %n"/> </l:context> </l:l10n> </l:i18n> 2) Pass it to xsltproc a2x -k -f pdf -a docinfo1 -d book --xsltproc-opts "--param local.l10n.xml document\(\'$SRCDIR/resources/custom-format.xml\'\)" -- fop $SRCDIR/book/book.txt -v -D $TARGET 3) In AsciiDoc source file use the following syntax to include listings (basically, include listings inside examples), e.g. [[listing_name_for_referencing]] .Title Of The Listing ====================================== [source,java] ---- // some code here ---- ====================================== What you get is: - list of listing (similar to List of Content, Tables and Figures) - each listing titled like "Listing SomeNumber. SomeTitle" - each listing, figure and table referenced like "Listing/Table/Figure SomeNumber" BTW. Docbook is really huge, but all this xsl magic is well documented. To find the solution, I used the following resources: - http://www.sagehill.net/docbookxsl/CustomGentext.html#CustomGenText - http://www.sagehill.net/docbookxsl/TOCcontrol.htm - http://www.sagehill.net/docbookxsl/FormalTitles.html Some AsciiDoc resources were also helpful: - http://www.methods.co.nz/asciidoc/a2x.1.html - http://www.methods.co.nz/asciidoc/asciidoc-docbook-xsl.html - http://code.google.com/p/asciidoc/source/browse/doc/publishing-ebooks-with-asciidoc.txt?r=48d2ea0b6bb03531e28383a8056d0e6bcc0dac3c -- Regards / Pozdrawiam Tomek Kaczanowski http://kaczanowscy.pl/tomek On Sep 26, 8:21 am, Tomek Kaczanowski <[email protected]> wrote: > Thx Lex, > > that is what I suspected :) I will surely report back once I learn how > to solve my problem. > > -- > Cheers, > Tomek Kaczanowski > > On Sep 26, 4:17 am, Lex Trotman <[email protected]> wrote: > > > > > > > > > Hi Tomek, > > > It looks like no one here knows the answer. Unfortunately detailed > > advice on backends is beyond the scope of this list, although people > > help if they can or know the answer. > > > Perhaps you would be better asking on the docbook xsl or FOP forums, > > they would be more likely to have the expertise. > > > Cheers > > Lex > > > PS if you do get the answer please let us know so other asciidoc users > > can benefit > > > On 26 September 2011 01:20, Tomek Kaczanowski > > > <[email protected]> wrote: > > > Hi All, > > > > could anyone help me with this? I would really appreciate your help. > > > > -- > > > Regards, > > > Tomek Kaczanowski > > >http://kaczanowscy.pl/tomek > > > > On Sep 23, 12:22 am, Tomek Kaczanowski <[email protected]> > > > wrote: > > >> Hi All, > > > >> Assuming the following snippet of source AsciiDoc text: > > >> .SomeName > > >> [[listing_some_name]] > > >> [source,java] > > >> ---- > > >> // some code here > > >> ---- > > > >> Now I generate the PDF with the following command: > > >> a2x -k -f pdf -a docinfo1 -d book --fop $SRCDIR/book/book.txt -v -D > > >> $TARGET > > > >> In the generated PDF links to listings (<<listing_some_name>>) are > > >> being rendered as only titles, e.g. "SomeName"). What I would like to > > >> have is the "Listing 5.3" instead. I have tried various combinations, > > >> like: > > > >> <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> > > > >> This worked pretty well for Tables and Figures (as it was suggested by > > >> Henrik in the previous > > >> discussion:http://groups.google.com/group/asciidoc/browse_thread/thread/71711d51...), > > >> but I can not make it work for listings. > > >> I have also tried to change value of xref.with.number.and.title but > > >> this seems to be broken (nothing happens). > > > >> I readhttp://www.sagehill.net/docbookxsl/CustomGentext.htmlandalot > > >> of other docbook xsl information, but I still do not know how to do > > >> this. > > > >> Could you please help? > > > >> -- > > >> Regards, > > >> Tomek Kaczanowskihttp://kaczanowscy.pl/tomek > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "asciidoc" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]. > > > For more options, visit this group > > > athttp://groups.google.com/group/asciidoc?hl=en. -- You received this message because you are subscribed to the Google Groups "asciidoc" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/asciidoc?hl=en.
