OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: RE: [docbook] Customizing Xrefs to Appendices

Absolutely brilliant.  That did the trick.  Thank you, Bob!


-----Original Message-----
From: Bob Stayton [mailto:bobs@sagehill.net] 
Sent: April-25-13 7:33 PM
To: Morgan Hayward; docbook@lists.oasis-open.org
Subject: Re: [docbook] Customizing Xrefs to Appendices

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: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"/>

Bob Stayton
Sagehill Enterprises

From: Morgan Hayward
Sent: Thursday, April 25, 2013 1:46 PM
To: docbook@lists.oasis-open.org
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.


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

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.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]