docbook-apps

  • 1.  Xref Numbering

    Posted 07-31-2008 16:45
    I need my xref in my docbook for class notes
    to have page numbers in my PDF generated file.

    I follow the instructions in Bob Stayton's DocBook XSL,
    The Cmplete Guide, on page 183, Chapter 13 of Cross References.
    It is generating in the fo file, "the section called ..." and the title
    rather than picking up the page number.

    Here is my customization layer in st.xsl



    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:import href="./titlepage.xsl"/>
    <xsl:import href="/opt/docbook/DOCBOOK/docbook-xsl-1.65.1/fo/docbook.xsl"/>
    <xsl:attribute-set name="formal.object.properties">
    <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
    </xsl:attribute-set>
    <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="section" text="II%p, %t"/>
    </l:context>
    </l:l10n>
    <l:l10n>
    <l:context name="xref-number">
    <l:template name="section" text="JJ%p, %t"/>
    </l:context>
    </l:l10n>
    <l:l10n>
    <l:context name="xref-number-and-style">
    <l:template name="section" text="KK%p, %t"/>
    </l:context>
    </l:l10n>
    </l:i18n>
    </xsl:stylesheet>

    (Note, I added the II, JJ, KK so I could easily see the cross reference
    generated if it picked it up my stylesheet. It did not.)

    Here is where I invoke docbook:

    #!/bin/sh

    # This script encapsulates a standard SAXON call.
    # This Script example borrowed from another application

    #JAVA_HOME=/usr/java/jdk1.5.0_04/jre
    JAVA_HOME=/usr

    SAXON_HOME=/opt/docbook/XEP/lib

    STYLESHEETS_HOME=/opt/docbook/XEP/doc/docbook/stylesheets

    CP=$JAVA_HOME/lib/tools.jar:$SAXON_HOME/saxon.jar:/opt/docbook/DOCBOOK/docbook-xsl-1.65.1/extensions/saxon653.jar:/opt/docbook/xerces-2_6_0/xercesImpl.jar

    NEW_LIB_HOME=/opt/docbook/DOCBOOK/FOP/fop-0.20.5/lib

    /usr/bin/java -Xbootclasspath/p:$NEW_LIB_HOME/xalan-2.4.1.jar:$NEW_LIB_HOME/xercesImpl-2.2.1.jar:$NEW_LIB_HOME/xml-apis.jar -classpath $CP com.icl.saxon.StyleSheet \
    -o $1.fo $1 \
    st.xsl \
    use.extensions=0 default.table.width=auto title.margin.left=0pc insert.xref.apage.number=yes


    And lastly, here is the input file:



    <para>
    <xref linkend="A"/>
    abc def ghi
    abc def ghi
    </para>
    <para>
    abc def ghi
    abc def ghi
    </para>
    <para>
    abc def ghi
    abc def ghi
    </para>
    <para>
    abc def ghi
    abc def ghi
    </para>

    <para>
    abc def ghi
    abc def ghi
    abc def ghi
    </para>



    (I included some additonal dummy text in the para that I added so the section
    entitled "AA AA" would be on a separate page.

    Here is what was generated for the cross reference line in the .fo
    output:


    <fo:basic-link internal-destination="A">the section called ??AA AA ?</fo:basic-link>

    Thanks for any help that any one can provide.

    I also tried the select: option but that did not work either.

    Dr. Laurence Leff Western Illinois University, Macomb IL 61455 ||(309) 298-1315
    Stipes 447 Assoc. Prof. of Computer Sci. Pager: 309-367-0787 FAX: 309-298-2302
    Secretary: eContracts Technical Committee OASIS Legal XML Member Section



  • 2.  Re: [docbook-apps] Xref Numbering

    Posted 07-31-2008 17:49
    
    
    Hi Laurence

    Try this:

    <!-- ==================================================================== -->
    <!-- define named xrefstyles for appendix, chapter, figure, part, sect1,sect2, sect3 section, table (all same: "page_ref"), and for formalpara ("fp_page_ref") -->
    <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="appendix" style="page_ref" text="Appendix&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="chapter"  style="page_ref" text="Chapter&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="figure"   style="page_ref" text="Figure&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="part"     style="page_ref" text="Part&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="sect1"    style="page_ref" text="Section&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="sect2"    style="page_ref" text="Section&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="sect3"    style="page_ref" text="Section&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="sect4"    style="page_ref" text="Section&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="sect5"    style="page_ref" text="Section&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="section"  style="page_ref" text="Section&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    <l:template name="table"    style="page_ref" text="Table&#x00A0;%n&#x002C;&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p" />
    </l:context>
    <l:context name="xref">
    <l:template name="formalpara" style="fp_page_ref" text="Paragraph&#x00A0;&#x201C;%t&#x201D;" />
    <l:template name="olink.page.citation" text=" (page %p)"/>
    <l:template name="page.citation" text=" [%p]"/>
    <l:template name="page" text="(page %p)"/>
    <l:template name="docname" text=" in %o"/>
    <l:template name="docnamelong" text=" in the document titled %o"/>
    <l:template name="pageabbrev" text="(p. %p)"/>
    <l:template name="Page" text="Page %p"/>
    </l:context>
    </l:l10n>
    </l:i18n>
    <!--
    Use of '%p' in fp_page_ref, - xref link to a formalpara - doesn't seem to work, backwards or forward - see test code in venn.xml
    So the ref. to 'p.%p' is removed in the above template.  %t for the formalpara id works OK.&nbsp; %n is not relevant, formalpara cannot be numbered.  If and when %p works for formalpara, replace the above template by:

    <l:template name="formalpara" style="fp_page_ref" text="Paragraph&#x00A0;&#x201C;%t&#x201D;&#x002C;&#x00A0;&#x0070;&#x002E;%p&#x002C;" />

    To get a 'close' page ref. in a pointer to a formal para, do something like:

    <xref linkend="id of formal para" xrefstyle="fp_page_ref" /> in <xref linkend="id of chapter or section containing the formal para" xrefstyle="page_ref" />

    This will at least point the reader to the right chapter or section in a chapter.  sect1, sect2 etc. should also work to localize more closely - untested.
     -->

    <!-- ==================================================================== -->



    I need my xref in my docbook for class notes
    to have page numbers in my PDF generated file. 

    I follow the instructions in Bob Stayton's DocBook XSL,
    The Cmplete Guide, on page 183, Chapter 13 of Cross References.
    It is generating in the fo file, "the section called ..." and the title
    rather than picking up the page number.

    Here is my customization layer in st.xsl


    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:import href="./titlepage.xsl"/>
    <xsl:import href="/opt/docbook/DOCBOOK/docbook-xsl-1.65.1/fo/docbook.xsl"/>
    <xsl:attribute-set name="formal.object.properties">
      <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
    </xsl:attribute-set>
    <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="section" text="II%p, %t"/>
    </l:context>
    </l:l10n>
    <l:l10n>
    <l:context name="xref-number">
    <l:template name="section" text="JJ%p, %t"/>
    </l:context>
    </l:l10n>
    <l:l10n>
    <l:context name="xref-number-and-style">
    <l:template name="section" text="KK%p, %t"/>
    </l:context>
    </l:l10n>
    </l:i18n>
    </xsl:stylesheet>

    (Note, I added the II, JJ, KK so I could easily see the cross reference
    generated if it picked it up my stylesheet.  It did not.)

    Here is where I invoke docbook:

    #!/bin/sh

    # This script encapsulates a standard SAXON call.
    #   This Script example borrowed from another application

    #JAVA_HOME=/usr/java/jdk1.5.0_04/jre
    JAVA_HOME=/usr

    SAXON_HOME=/opt/docbook/XEP/lib

    STYLESHEETS_HOME=/opt/docbook/XEP/doc/docbook/stylesheets

    CP=$JAVA_HOME/lib/tools.jar:$SAXON_HOME/saxon.jar:/opt/docbook/DOCBOOK/docbook-xsl-1.65.1/extensions/saxon653.jar:/opt/docbook/xerces-2_6_0/xercesImpl.jar

    NEW_LIB_HOME=/opt/docbook/DOCBOOK/FOP/fop-0.20.5/lib

    /usr/bin/java -Xbootclasspath/p:$NEW_LIB_HOME/xalan-2.4.1.jar:$NEW_LIB_HOME/xercesImpl-2.2.1.jar:$NEW_LIB_HOME/xml-apis.jar -classpath $CP com.icl.saxon.StyleSheet \
       -o $1.fo $1 \
       st.xsl \
       use.extensions=0 default.table.width=auto title.margin.left=0pc insert.xref.apage.number=yes


    And lastly, here is the input file:


    <section><title>tit</title>
    <para>
    <xref linkend="A"/>
    abc def ghi
    abc def ghi
    </para>
    <para>
    abc def ghi
    abc def ghi
    </para>
    <para>
    abc def ghi
    abc def ghi
    </para>
    <para>
    abc def ghi
    abc def ghi
    </para>
    <section id="A"><title id="A.title">AA AA</title>
    <para>
    abc def ghi
    abc def ghi
    abc def ghi
    </para>
    </section>
    </section>

    (I included  some additonal dummy text in the para that I added so the section
    entitled "AA AA" would be on a separate page.

    Here is what was generated for the cross reference line in the .fo
    output:


    <fo:basic-link internal-destination="A">the section called ’ÄúAA AA’Äù</fo:basic-link>

    Thanks for any help that any one can provide.

    I also tried the select: option but that did not work either.

    Dr. Laurence Leff  Western Illinois University, Macomb IL 61455 ||(309) 298-1315
    Stipes 447 Assoc. Prof. of Computer Sci. Pager: 309-367-0787 FAX: 309-298-2302
    Secretary: eContracts Technical Committee OASIS Legal XML Member Section

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


    Ron Catterall, Phd, DSc       email: ron@catterall.net
    Prolongacion de Hidalgo 140http://catterall.net/
    San Felipe del Aguatel: +52 951 520 1821
    Oaxaca      68020Mexicofax: +1 530 348 8309