</xsl:template>
<xsl:template match="refnamediv">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <fo:block id="{$id}">
+
+ <!-- if refentry.generate.name is non-zero, then we need to generate a -->
+ <!-- localized "Name" subheading for this refnamdiv (unless it has a -->
+ <!-- preceding sibling that is a refnamediv, in which case we have already -->
+ <!-- generated a "Name" subheading, so we don't need to do it again -->
+ <xsl:if test="$refentry.generate.name != 0">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::refnamediv">
+ <!-- no generated title on secondary refnamedivs! -->
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="refnamediv.titlepage.recto.style"
+ font-family="{$title.fontset}">
+ <!-- Contents of what is now the format.refentry.subheading -->
+ <!-- template were formerly intended to be used only to -->
+ <!-- process those subsections of Refentry that have "real" -->
+ <!-- title children. So as a kludge to get around the fact -->
+ <!-- that the template still basically "expects" to be -->
+ <!-- processing that kind of a node, when we call the -->
+ <!-- template to process generated titles, we must call it -->
+ <!-- with values for the "offset" and "section" parameters -->
+ <!-- that are different from the default values in the -->
+ <!-- format.refentry.subheading template itself. Because -->
+ <!-- those defaults are the values appropriate for processing -->
+ <!-- "real" title nodes. -->
+ <xsl:call-template name="format.refentry.subheading">
+ <xsl:with-param name="section" select="self::*"/>
+ <xsl:with-param name="offset" select="1"/>
+ <xsl:with-param name="gentext.key" select="'RefName'"/>
+ </xsl:call-template>
+ </fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="$refentry.generate.title != 0">
<xsl:variable name="section.level">
<xsl:call-template name="refentry.level">
<xsl:with-param name="node" select="ancestor::refentry"/>
</xsl:variable>
<xsl:variable name="reftitle">
- <xsl:choose>
- <xsl:when test="$refentry.generate.name != 0">
- <xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'RefName'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$refentry.generate.title != 0">
<xsl:choose>
<xsl:when test="../refmeta/refentrytitle">
<xsl:apply-templates select="../refmeta/refentrytitle"/>
<xsl:apply-templates select="refname[1]"/>
</xsl:otherwise>
</xsl:choose>
- </xsl:when>
- </xsl:choose>
</xsl:variable>
<!-- xsl:use-attribute-sets takes only a Qname, not a variable -->
- <fo:block>
<xsl:choose>
<xsl:when test="preceding-sibling::refnamediv">
<!-- no title on secondary refnamedivs! -->
</fo:block>
</xsl:otherwise>
</xsl:choose>
+ </xsl:if>
<fo:block>
<xsl:if test="not(following-sibling::refnamediv)">
|refsect3/title"
mode="titlepage.mode"
priority="2">
- <xsl:variable name="section" select="parent::*"/>
+ <xsl:call-template name="format.refentry.subheading"/>
+</xsl:template>
+
+<xsl:template name="format.refentry.subheading">
+<!-- This template is now called to process generated titles for -->
+<!-- Refnamediv and Refsynopsisdiv, as well as "real" titles for -->
+<!-- Refsynopsisdiv, Refsection, and Refsect[1-3]. -->
+<!-- -->
+<!-- But the contents of this template were formerly intended to be used -->
+<!-- only to process those subsections of Refentry that have "real" title -->
+<!-- children. So as a kludge to get around the fact that the template -->
+<!-- still basically "expects" to be processing that kind of a node, the -->
+<!-- "offset" parameter was added and the "section" variable was changed to -->
+<!-- a parameter so that when called for a generated title on a Refnamediv -->
+<!-- or Refsynopsisdiv, we can call it like this: -->
+<!-- -->
+<!-- <xsl:call-template name="format.refentry.subheading"> -->
+<!-- <xsl:with-param name="section" select="self::*"/> -->
+<!-- <xsl:with-param name="offset" select="1"/> -->
+<!-- <xsl:with-param name="gentext.key" select="'RefName'"/> -->
+<!-- </xsl:call-template> -->
+<!-- -->
+ <xsl:param name="section" select="parent::*"/>
+ <xsl:param name="offset" select="0"/>
+ <xsl:param name="gentext.key"/>
+
<fo:block keep-with-next.within-column="always">
<xsl:variable name="id">
<xsl:call-template name="object.id">
</xsl:variable>
<xsl:variable name="title">
- <xsl:apply-templates select="$section" mode="object.title.markup">
- <xsl:with-param name="allow-anchors" select="1"/>
- </xsl:apply-templates>
+ <!-- If we have a non-empty value for the $gentext.key param, then we -->
+ <!-- generate an appropriate title here. Otherwise, we have a real -->
+ <!-- title child, so we copy contents of that to the result tree. -->
+ <xsl:choose>
+ <xsl:when test="$gentext.key != ''">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="$gentext.key"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$section" mode="object.title.markup">
+ <xsl:with-param name="allow-anchors" select="1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
<xsl:if test="$passivetex.extensions != 0">
<fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
- fotex-bookmark-level="{$level + 2}"
+ fotex-bookmark-level="{$level + 2 + $offset}"
fotex-bookmark-label="{$id}">
<xsl:value-of select="$title"/>
</fotex:bookmark>
<xsl:if test="$axf.extensions != 0">
<xsl:attribute name="axf:outline-level">
- <xsl:value-of select="count(ancestor::*)-1"/>
+ <xsl:value-of select="count(ancestor::*)-1 + $offset"/>
</xsl:attribute>
<xsl:attribute name="axf:outline-expand">false</xsl:attribute>
<xsl:attribute name="axf:outline-title">
- <xsl:value-of select="normalize-space($title)"/>
+ <xsl:value-of select="$title"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="section.heading">
- <xsl:with-param name="level" select="$level"/>
+ <xsl:with-param name="level" select="$level + $offset"/>
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
</fo:block>