Hi Jeff,
I'm sorry to report that part of what you were
looking at was a wild goose chase. The title.xref template is
obsolete. It is called by the template named xref.t.subst, which is also
obsolete and commented out in the stylesheets. I think they were left
behind in case they needed to be restored after changes were made, but then were
forgotten. I'll clean them up.
The template that controls the italics is that with
mode="insert.title.markup". Your template matching on "chapter|appendix" in that
mode should do it for both chapter and appendix. It is used for both
titles and xrefs, but its behavior can be modified by using the template
param named "purpose", which will be 'xref' for cross references, including
olinks.
I tested your templates in a simple customization
layer and they produce the same output for olinks to both chapter and appendix:
no italic, bold, and color for the whole string. I did not get italic for
the appendix olink.
Are you regenerating the target data before each
build (set collect.xref.targets="yes")? The inline formats used in olink
text are actually stored in the target data set (e.g., in target.db), so you
won't see updates if that file is not updated.
What version of DocBook XSL are you
using?
Bob Stayton
Sagehill Enterprises
----- Original Message -----
From:
Jeff
Powanda
To:
Sent: Tuesday, February 17, 2009 11:47
PM
Subject: [docbook-apps] olinks to
appendixes displays italic
Versions: DocBook 4.5, FOP
0.93
In FO output, I want olinks to
appendixes to NOT display italic. Olinks Even though I customized the
following templates, olinks to appendixes always display italic. What am I
doing wrong? Seems like all I should need to modify is the
insert.olink.docname.markup mode template, but that doesn’t work. How can I
make the olink to an appendix display normal font (like it does for olinks to
chapters)?
<xsl:template
name="title.xref">
<xsl:param
name="target"
select="."/>
<xsl:choose>
<xsl:when
test="local-name($target)
= 'figure'
or local-name($target) = 'example'
or local-name($target) = 'equation'
or local-name($target) = 'table'
or local-name($target) = 'dedication'
or local-name($target) = 'preface'
or local-name($target) = 'bibliography'
or local-name($target) = 'glossary'
or local-name($target) = 'index'
or local-name($target) = 'setindex'
or local-name($target) = 'colophon'
or local-name($target) = 'appendix'">
<xsl:call-template
name="gentext.startquote"/>
<xsl:apply-templates
select="$target"
mode="title.markup"/>
<xsl:call-template
name="gentext.endquote"/>
</xsl:when>
<xsl:otherwise>
<!—Commented
out italic-->
<!--
<fo:inline font-style="italic">-->
<xsl:apply-templates
select="$target"
mode="title.markup"/>
<!--
</fo:inline>-->
</xsl:otherwise>
</xsl:choose>
</xsl:template>
This template formats the Title text. -->
<xsl:template
match="section"
mode="insert.title.markup">
<xsl:param
name="purpose"/>
<xsl:param
name="xrefstyle"/>
<xsl:param
name="title"/>
<xsl:choose>
<xsl:when
test="$purpose
= 'xref'">
<fo:inline
font-weight="bold"
color="#1892FF"
font-style="normal">
<xsl:copy-of
select="$title"/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of
select="$title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template
match="chapter|appendix"
mode="insert.title.markup">
<xsl:param
name="purpose"/>
<xsl:param
name="xrefstyle"/>
<xsl:param
name="title"/>
<fo:inline
font-weight="bold"
color="#1892FF"
font-style="normal">
<xsl:copy-of
select="$title"/>
</fo:inline>
</xsl:template>
<!--
This attribute set makes the title blue and the page citation black.
-->
<!--
Internal olinks (and all ulinks) use xref properties.
-->
<xsl:attribute-set
name="xref.properties">
<xsl:attribute
name="color">
<xsl:choose>
<xsl:when
test="self::olink
or self::ulink">#1892FF</xsl:when>
<xsl:otherwise>black</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute
name="font-weight">
<xsl:choose>
<xsl:when
test="self::olink
or self::ulink">bold</xsl:when>
<xsl:otherwise>normal</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
<!--
Formatting for external olinks: olinks that point to chapters in other books
(not the current book). -->
<!--
Internal olinks use xref properties. -->
<xsl:param
name="olink.doctitle">yes</xsl:param>
<xsl:attribute-set
name="olink.properties">
<xsl:attribute
name="color">#1892FF</xsl:attribute>
<xsl:attribute
name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:template
match="*"
mode="insert.olink.docname.markup">
<xsl:param
name="docname"
select="''"/>
<!—Commented
out italic-->
<!--
<fo:inline font-style="italic">-->
<xsl:value-of
select="$docname"/>
<!--
</fo:inline>-->
</xsl:template>
<xsl:template
match="chapter|appendix"
mode="insert.olink.docname.markup">
<xsl:param
name="docname"
select="''"/>
<!—Commented
out italic-->
<!--
<fo:inline font-style="italic">-->
<xsl:value-of
select="$docname"/>
<!--
</fo:inline>-->
</xsl:template>