Skip to content

<xref/> to <procedure> ignores localized context override in DocBook XSLT 1.0 #275

Description

@tomschr

Situation

When using DocBook 5 with the DocBook XSLT 1.0 stylesheets (XHTML output), a localized context override for the element name procedure is honored for titles, but ignored for <xref/> resolution.

This occurs when you customize the term "Procedure" for German and want to replace it by "Vorgehen". I think, the issue appears for other language as well.

Environment

  • DocBook: 5.2
  • Stylesheets: DocBook XSLT 1.0 (namespaced, XHTML) 1.79.2
  • Processor: xsltproc
  • Output format: XHTML
  • Language: German (xml:lang="de")

Proof-of-concept

Here are the example files shown this problem for a German document:

Article (article.xml)
<article xml:lang="de" version="5.2"
  xmlns="http://docbook.org/ns/docbook"
  xmlns:xlink="http://www.w3.org/1999/xlink">
  
  <title>Beispielartikel</title>
  
  <para>
    Siehe <xref linkend="proc.install"/>.
  </para>
  
  <procedure xml:id="proc.install">
    <title>Installation durchführen</title>
    
    <step>
      <para>Paket herunterladen.</para>
    </step>
    
    <step>
      <para>Paket installieren.</para>
    </step>
  </procedure>
  
</article>
Language file (l10n.xml)
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
  <l:l10n language="de" english-language-name="German">
    <l:gentext key="Procedure" text="Vorgehen"/>
    <l:gentext key="procedure" text="Vorgehen"/>
    
    <l:context name="title">
      <l:template name="procedure.formal" text="Vorgehen %n. %t"/>
    </l:context>

    <l:context name="xref-number">
      <l:template name="procedure" text="Vorgehen %n"/>
    </l:context>

    <l:context name="xref-number-and-title">
      <l:template name="procedure.formal" text="Vorgehen %n. %t"/>
    </l:context>
  </l:l10n>
</l:i18n>
Stylesheet (db2xhtml.xsl)
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/xhtml5/docbook.xsl"/>

  <xsl:param name="local.l10n.xml" select="document('l10n.xml')"/>

</xsl:stylesheet>

Store everything in one directory and call this command:

xsltproc --output article.html db2xhtml.xsl article.xml

The result is this:

Image

Expected Result

The <xref/> text should use the customized language context for procedure, for example.:

Siehe Vorgehen 1, „Installation durchführen“.

Analysis / Notes

  • The custom localization is correctly loaded and applied (verified via title output).
  • The issue appears specific to <procedure> and <xref/>.
  • It seems that, in DocBook XSLT 1.0, <xref/> to procedure does not consult gentext with context xref, but instead falls back to a hard-coded localized object name.
  • This makes it impossible to fully localize procedure references via local.l10n.xml alone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions