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


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

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

Subject: Re: [docbook-apps] xrefs to <title> elements don't work

Hi Eric,

On Fri, 5 Apr 2013 01:00:45 +0000
Eric Nordlund <nordlund@cray.com> wrote:

> [... @id attributes in titles instead of parent...]
> Is there a way to make these work in the XSL-FO output? I was
> thinking I could have a template that could recognize when an
> xref/@linkend pointed to the id of a title and then change the
> linkend to the id of the title's parent element, but I don't really
> know how to do that.
> Is there another way to do what I need to do?

Well, my impression was that the DocBook XSL stylesheets takes this
into account, so in theory it doesn't matter if the @id was placed
wrongly. Maybe I'm wrong, I haven't tested that.

However, if you really care, I would target your issue from a different
angle: use XSLT to move your @id attribute to its parent element. Pass
the result to your DocBook stylesheets (or your customization layer).
No FO customization is needed in this case. :)

Here is a stylesheet that moves an @id attribute from a title
element to its parent element (probably it's incomplete, but it should
be easy to extent it):

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

  <xsl:output method="xml"
    doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"

  <xsl:template match="node() | @*" name="copy">
      <xsl:apply-templates select="@* | node()"/>
  <xsl:template match="title/@id"/>
  <xsl:template name="copytitleid">
      <xsl:copy-of select="@*"/>
      <xsl:if test="(title/@id|
        <xsl:attribute name="id">
          <xsl:value-of select="(title/@id|
  <xsl:template match="appendix|article|book|
    <xsl:call-template name="copytitleid"/>
  <xsl:template match="figure|example|procedure|task">
    <xsl:call-template name="copytitleid"/>


    Thomas Schraitle

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