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


It sounded like, from Nordlund's description, his sections already have IDs. So it might cause problems to replace those IDs.

We'd need to know: do ALL xrefs target titles, NONE of them target actual sections?

--Aaron DaMommio


On Fri, Apr 5, 2013 at 1:53 AM, Thomas Schraitle <tom_schr@web.de> wrote:
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"
  version="1.0">

  <xsl:output method="xml"
    indent="yes"
    doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"
    doctype-system="http://www.docbook.org/xml/4.5/docbookx.dtd"/>

  <xsl:template match="node() | @*" name="copy">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="title/@id"/>

  <xsl:template name="copytitleid">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:if test="(title/@id|
                     *[contains(local-name(),'info')]/title/@id)">
        <xsl:attribute name="id">
          <xsl:value-of select="(title/@id|
                                 *[contains(local-name(),'info')]/title/@id)[1]"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="appendix|article|book|
                       bibliography|bibliodiv|
                       chapter|colophon|
                       dedication|glossary|
                       preface|part|reference|
                       refsection|refsect1|refsect2|refsect3|
                       set|
                       section|sect1|sect2|sect3|sect4|sect5">
    <xsl:call-template name="copytitleid"/>
  </xsl:template>

  <xsl:template match="figure|example|procedure|task">
    <xsl:call-template name="copytitleid"/>
  </xsl:template>

</xsl:stylesheet>
---------------------------------

--
Gruß/Regards,
    Thomas Schraitle

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org




--
--------------------------------------
Aaron DaMommio: Husband, father, writer, juggler, and expert washer of dishes.
- My blog: http://aarondamommio.blogspot.com
- Need a juggler?  http://amazingaaronjuggler.blogspot.com/
=======================================


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