XML technologies / DocBook / The DocBook XSL stylesheets / Customizing cross-references / Customizing with the gentext template
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
To customize cross-references throughout a document, create and edit language files (explained in Customizing language files). Cross-references use three types of l:context element:
<l:context name="xref">Contains cross-references to unnumbered elements, including chapters if the parameter
chapter.autolabelis zero. The same applies toappendix,part,prefaceandsectionand their corresponding parameters.<l:context name="xref-number">Contains cross-references to numbered elements such as
appendix,chapter,figureandtable. This also applies to numbered sections whenxref.with.number.and.title=0.<l:context name="xref-number-and-title">Cross-references to numbered elements, including element name, number and title, when
xref.with.number.and.title=1(the default).
The file common/de.xml contains entries such as:
Example: Cross-reference excerpt from the German language file
<l:context name="xref">
<l:template name="appendix" text="%t"/>
<l:template name="chapter" text="%t"/>
<l:template name="example" text="%t"/>
...
</l:context>
<l:context name="xref-number">
<l:template name="appendix" text="Anhang %n"/>
<l:template name="chapter" text="Kapitel %n"/>
<l:template name="example" text="Beispiel %n"/>
...
</l:context>
<l:context name="xref-number-and-title">
<l:template name="appendix" text="Anhang %n, %t"/>
<l:template name="chapter" text="Kapitel %n, %t"/>
<l:template name="example" text="Beispiel %n, „%t“"/>
...
</l:context>Here,   represents a non-breaking space (non-breakable space). This keeps the word and number together. To customize cross-references, proceed as follows:
Choose how to reference the language file: directly in the stylesheet (Customizing localized text) or separately (Adding custom entries).
Determine the cross-reference format:
If the parameter
xref.with.number.and.titlehas the value1(the default), use the contextxref-number-and-title.If the parameter
xref.with.number.and.titlehas the value0use the contextxref-number.For example, if the parameter
chapter.autolabelhas the value0(disabling chapter numbering), use the contextxref.
Customize the corresponding context to your requirements.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top