Hi Morgan,
I don't think you can do this with just the gentext mechanism. In the l10n
files, "l:context" is a named context for gentext, not the XML context of an
element in the document hierarchy. So that file cannot distinguish if a
section is in an appendix or not.
When an xref is being resolved, the stylesheet locates the target element,
and applies templates in mode="xref-to" to generate the text for it.
Normally those templates apply templates in mode="object.xref.markup", which
triggers the gentext process using the l:template for that element.
You can create a custom template in mode="xref-to" for sections in an
appendix and assemble your custom text there. Something like this:
<!-- the context node here is appendix//section -->
<xsl:template match="section[ancestor::appendix]" mode="xref-to">
<!-- generate the word "Appendix" -->
<xsl:call-template name="gentext">
<xsl:with-param name="key">appendix</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<!-- generate the appendix letter -->
<xsl:apply-templates select="ancestor::appendix" mode="label.markup"/>
<!-- insert punctuation -->
<xsl:text>, '</xsl:text>
<!-- generate the title for the section -->
<xsl:apply-templates select="." mode="title.markup"/>
<xsl:text>'</xsl:text>
</xsl:template>
Bob Stayton
Sagehill Enterprises
[email protected]
From: Morgan Hayward
Sent: Thursday, April 25, 2013 1:46 PM
To: [email protected]
Subject: [docbook] Customizing Xrefs to Appendices
In our DocBook customization, we've removed all section numbering in our
appendices, but we still have xref's in some of our manuals that reference
those sections. They end up displaying as "Section E.3, 'Section Title'".
We would like them to display as "Appendix E, 'Section Title'".
I understand how to create an l:template for a specific element, but I'm
lost when it comes to defining the context. Does anyone know how to tell
DocBook to use a different xref format for a section in appendix compared to
a section in a chapter?
Thanks in advance for your help.
Regards,
Morgan
Morgan Hayward
Technical Writer, Documentation
RuggedCom, A Siemens Company
Office: (905) 482-4599 | Toll Free: 1 (888) 264-0006
300 Applewood Cres. Concord, Ontario L4K 5C7
CONFIDENTIALITY NOTICE:
This e-mail and any attachments may contain proprietary information some
of which may be legally privileged. It is for the intended recipient only.
If an addressing or transmission error has misdirected this e-mail, please
notify the author by replying to it. If you are not the intended recipient
you may not use, disclose, distribute, copy, print or rely on this e-mail.
Think Before You Print.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]