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] | [Elist Home]


Subject: DOCBOOK-APPS: XSL: fix xref to question


I've converted an FAQ article from DocBook SGML 3.1 to DocBook XML 4.0.
Accordingly, I'm experimenting with version 1.13 of the XSL DocBook
Stylesheets to replace the DSSSL stylesheets.

I found that an xref to a question doesn't work.  The following XML

    <xref linkend="foo"/>
    ...
    <question id="foo">

generates the following HTML:

    <a href="#foo"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0">[Don't know what
gentext to create for xref to: "question"]</a>

    <a name="N3766">

There are two problems: the generated text is incorrect and the links don't
match.  Questions have some similarities to sections, so I looked to see
how they are handled.  I'm new to XSL, but I'd like to propose some fixes.

The following additions to html/xref.xsl handle the generated text:

201a202,208
>           <!-- *jcw+5, 6/5/00: fix xref to question -->
>           <xsl:when test="$refelem='question'">
>             <xsl:call-template name="xref.question">
>               <xsl:with-param name="target" select="$target"/>
>             </xsl:call-template>
>           </xsl:when>
>
408a418,429
> </xsl:template>
>
> <!-- *jcw+10, 6/5/00: fix xref to question -->
> <xsl:template name="xref.question">
>   <xsl:param name="target" select="."/>
>   <xsl:param name="refelem" select="name($target)"/>
>
>       <xsl:call-template name="gentext.element.name">
>         <xsl:with-param name="element.name" select="$refelem"/>
>       </xsl:call-template>
>       <xsl:text> </xsl:text>
>       <xsl:apply-templates select="$target" mode="label.content"/>

The following changes to html/qandaset.xsl fix the links:

91,93c91,92
<     <xsl:call-template name="object.id">
<       <xsl:with-param name="object" select="parent::*"/>
<     </xsl:call-template>
---
>     <!-- *jcw+1, 6/5/00: fix question IDs -->
>     <xsl:call-template name="object.id" />
172,176c171
<   <xsl:variable name="id">
<     <xsl:call-template name="object.id">
<       <xsl:with-param name="object" select="parent::*"/>
<     </xsl:call-template>
<   </xsl:variable>
---
>   <!-- *jcw, 6/5/00: fix question IDs -->
183,185c178,179
<         <xsl:call-template name="href.target">
<           <xsl:with-param name="object" select="parent::*"/>
<         </xsl:call-template>
---
>         <!-- *jcw+1, 6/5/00: fix question IDs -->
>         <xsl:call-template name="href.target" />

Finally, to match the style of the DSSSL stylesheets, I added the following
to my customization layer:

    <xsl:variable name="qanda.inherit.numeration" select="1"/>

This makes the generated text look like "Q: 4.4," instead of "Q: 4."  I
propose that this variable be set by default.

It occurs to me that this fix, if you find it acceptable, should be ported
to fo/xref.xsl.

--Jon
--
Jon Willeke, Quality Engineer
InterSystems Corp.
One Memorial Drive, Cambridge, MA 02142


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


Powered by eList eXpress LLC