[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
The page numbers are not handled by the simple.xlink template, but by the template in fo/xref.xsl that matches on xref.
<xsl:apply-templates select="$target" mode="page.citation">
It is trying to process the title element (the value of $target) in mode="page.citation". It generates the correct code, but the id for title is not in the fo output, so the xsl-fo processor cannot find the id to get the page number. So you will need to create a template like this (untested) to generate the page citation for the parent of title:
<xsl:template match="title" mode="page.citation">
<xsl:apply-templates select="parent::*" mode="page.citation"/>
I think that will work.
Thanks Bob. Your suggested style sheet customization worked for our documents; the links work and the correct text is displayed for the xref.
One thing that I noticed is that the page.citation dows not work for the titles, however. This isn?t a big deal for me because I just turn them off on title xrefs, but is there a way to get that template to work with title xrefs the same way that they would for section xrefs? Right now they show up as ?<title text> on page .?
From: Bob Stayton
Actually, creating an xref to a title used to work in the stylesheets. Currently it gets the generated text right, but the link is to the id of the title element, and most title elements do not output an @id attribute, so the link fails. It seems this feature was broken some time ago when the xref templates were rewritten to support universal linking in DocBook 5.
This customization of the template named 'simple.xlink' from fo/inline.xsl fixes the id problem. It only corrects the problem for @linkend references, not for @xlink:href references used in universal linking, but it should suffice for your needs. Search for 'linkend.candidate' to see where I made the changes.
<!-- Is it a local idref? -->
<!-- Is it an olink ? -->
<xsl:when test="$is.idref = 1">
<!-- otherwise it's a URI
My company has a hundred or so books that were authored with Arbortext?s graphic XML editor. I?m having a problem processing these books with XSL-FO because so many of the xrefs in these books are to title elements instead of the parent procedure, section, example, table, etc., elements.
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?
Customer Documentation and Training
901 5th Ave
Seattle, WA 98164