| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637 | <?xml version='1.0'?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                xmlns:fo="http://www.w3.org/1999/XSL/Format"                xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"                version='1.0'><!-- ********************************************************************     $Id$     ********************************************************************     This file is part of the XSL DocBook Stylesheet distribution.     See ../README or http://docbook.sf.net/release/xsl/current/ for     copyright and other information.     ******************************************************************** --><!-- ==================================================================== --><xsl:template match="reference">   <xsl:if test="not(partintro)">    <xsl:variable name="id">      <xsl:call-template name="object.id"/>    </xsl:variable>    <xsl:variable name="master-reference">      <xsl:call-template name="select.pagemaster"/>    </xsl:variable>    <fo:page-sequence hyphenate="{$hyphenate}"                      master-reference="{$master-reference}">      <xsl:attribute name="language">        <xsl:call-template name="l10n.language"/>      </xsl:attribute>      <xsl:attribute name="format">        <xsl:call-template name="page.number.format">          <xsl:with-param name="master-reference" select="$master-reference"/>        </xsl:call-template>      </xsl:attribute>      <xsl:attribute name="initial-page-number">        <xsl:call-template name="initial.page.number">          <xsl:with-param name="master-reference" select="$master-reference"/>        </xsl:call-template>      </xsl:attribute>      <xsl:attribute name="force-page-count">        <xsl:call-template name="force.page.count">          <xsl:with-param name="master-reference" select="$master-reference"/>        </xsl:call-template>      </xsl:attribute>      <xsl:attribute name="hyphenation-character">        <xsl:call-template name="gentext">          <xsl:with-param name="key" select="'hyphenation-character'"/>        </xsl:call-template>      </xsl:attribute>      <xsl:attribute name="hyphenation-push-character-count">        <xsl:call-template name="gentext">          <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>        </xsl:call-template>      </xsl:attribute>      <xsl:attribute name="hyphenation-remain-character-count">        <xsl:call-template name="gentext">          <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>        </xsl:call-template>      </xsl:attribute>      <xsl:apply-templates select="." mode="running.head.mode">        <xsl:with-param name="master-reference" select="$master-reference"/>      </xsl:apply-templates>      <xsl:apply-templates select="." mode="running.foot.mode">        <xsl:with-param name="master-reference" select="$master-reference"/>      </xsl:apply-templates>      <fo:flow flow-name="xsl-region-body">        <xsl:call-template name="set.flow.properties">          <xsl:with-param name="element" select="local-name(.)"/>          <xsl:with-param name="master-reference" select="$master-reference"/>        </xsl:call-template>        <fo:block id="{$id}">          <xsl:call-template name="reference.titlepage"/>        </fo:block>        <!-- Create one page sequence if no pagebreaks needed -->        <xsl:if test="$refentry.pagebreak = 0">          <xsl:apply-templates select="refentry"/>        </xsl:if>      </fo:flow>    </fo:page-sequence>  </xsl:if>  <xsl:apply-templates select="partintro"/>  <xsl:if test="$refentry.pagebreak != 0">    <xsl:apply-templates select="refentry"/>  </xsl:if></xsl:template><xsl:template match="reference" mode="reference.titlepage.mode">  <xsl:call-template name="reference.titlepage"/></xsl:template><xsl:template match="reference/partintro">  <xsl:variable name="id">    <xsl:call-template name="object.id">      <xsl:with-param name="object" select="ancestor::reference"/>    </xsl:call-template>  </xsl:variable>  <xsl:variable name="master-reference">    <xsl:call-template name="select.pagemaster"/>  </xsl:variable>  <fo:page-sequence hyphenate="{$hyphenate}"                    master-reference="{$master-reference}">    <xsl:attribute name="language">      <xsl:call-template name="l10n.language"/>    </xsl:attribute>    <xsl:attribute name="format">      <xsl:call-template name="page.number.format">        <xsl:with-param name="master-reference" select="$master-reference"/>      </xsl:call-template>    </xsl:attribute>    <xsl:attribute name="initial-page-number">      <xsl:call-template name="initial.page.number">        <xsl:with-param name="master-reference" select="$master-reference"/>      </xsl:call-template>    </xsl:attribute>    <xsl:attribute name="force-page-count">      <xsl:call-template name="force.page.count">        <xsl:with-param name="master-reference" select="$master-reference"/>      </xsl:call-template>    </xsl:attribute>    <xsl:attribute name="hyphenation-character">      <xsl:call-template name="gentext">        <xsl:with-param name="key" select="'hyphenation-character'"/>      </xsl:call-template>    </xsl:attribute>    <xsl:attribute name="hyphenation-push-character-count">      <xsl:call-template name="gentext">        <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>      </xsl:call-template>    </xsl:attribute>    <xsl:attribute name="hyphenation-remain-character-count">      <xsl:call-template name="gentext">        <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>      </xsl:call-template>    </xsl:attribute>    <xsl:apply-templates select="." mode="running.head.mode">      <xsl:with-param name="master-reference" select="$master-reference"/>    </xsl:apply-templates>    <xsl:apply-templates select="." mode="running.foot.mode">      <xsl:with-param name="master-reference" select="$master-reference"/>    </xsl:apply-templates>    <fo:flow flow-name="xsl-region-body">      <xsl:call-template name="set.flow.properties">        <xsl:with-param name="element" select="local-name(.)"/>        <xsl:with-param name="master-reference" select="$master-reference"/>      </xsl:call-template>      <fo:block id="{$id}">        <xsl:apply-templates select=".." mode="reference.titlepage.mode"/>      </fo:block>      <xsl:if test="title">        <xsl:call-template name="partintro.titlepage"/>      </xsl:if>      <xsl:apply-templates/>      <!-- Create one page sequence if no pagebreaks needed -->      <xsl:if test="$refentry.pagebreak = 0">        <xsl:apply-templates select="../refentry"/>      </xsl:if>    </fo:flow>  </fo:page-sequence></xsl:template><xsl:template match="reference/docinfo|refentry/refentryinfo"></xsl:template><xsl:template match="reference/info"></xsl:template><xsl:template match="reference/title"></xsl:template><xsl:template match="reference/subtitle"></xsl:template><!-- ==================================================================== --><xsl:template match="refentry">  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <xsl:variable name="master-reference">    <xsl:call-template name="select.pagemaster"/>  </xsl:variable>  <xsl:variable name="refentry.content">    <fo:block id="{$id}">      <xsl:apply-templates/>    </fo:block>  </xsl:variable>  <xsl:choose>    <xsl:when test="not(parent::*) or                     (parent::reference and $refentry.pagebreak != 0) or                     parent::part">      <!-- make a page sequence -->      <fo:page-sequence hyphenate="{$hyphenate}"                        master-reference="{$master-reference}">        <xsl:attribute name="language">          <xsl:call-template name="l10n.language"/>        </xsl:attribute>        <xsl:attribute name="format">          <xsl:call-template name="page.number.format">            <xsl:with-param name="master-reference" select="$master-reference"/>          </xsl:call-template>        </xsl:attribute>        <xsl:attribute name="initial-page-number">          <xsl:call-template name="initial.page.number">            <xsl:with-param name="master-reference" select="$master-reference"/>          </xsl:call-template>        </xsl:attribute>        <xsl:attribute name="force-page-count">          <xsl:call-template name="force.page.count">            <xsl:with-param name="master-reference" select="$master-reference"/>          </xsl:call-template>        </xsl:attribute>        <xsl:attribute name="hyphenation-character">          <xsl:call-template name="gentext">            <xsl:with-param name="key" select="'hyphenation-character'"/>          </xsl:call-template>        </xsl:attribute>        <xsl:attribute name="hyphenation-push-character-count">          <xsl:call-template name="gentext">            <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>          </xsl:call-template>        </xsl:attribute>        <xsl:attribute name="hyphenation-remain-character-count">          <xsl:call-template name="gentext">            <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>          </xsl:call-template>        </xsl:attribute>        <xsl:apply-templates select="." mode="running.head.mode">          <xsl:with-param name="master-reference" select="$master-reference"/>        </xsl:apply-templates>        <xsl:apply-templates select="." mode="running.foot.mode">          <xsl:with-param name="master-reference" select="$master-reference"/>        </xsl:apply-templates>        <fo:flow flow-name="xsl-region-body">          <xsl:call-template name="set.flow.properties">            <xsl:with-param name="element" select="local-name(.)"/>            <xsl:with-param name="master-reference" select="$master-reference"/>          </xsl:call-template>          <xsl:copy-of select="$refentry.content"/>        </fo:flow>      </fo:page-sequence>    </xsl:when>    <xsl:otherwise>      <fo:block>        <xsl:if test="$refentry.pagebreak != 0">          <xsl:attribute name="break-before">page</xsl:attribute>        </xsl:if>        <xsl:copy-of select="$refentry.content"/>      </fo:block>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template match="refmeta"></xsl:template><xsl:template match="manvolnum">  <xsl:if test="$refentry.xref.manvolnum != 0">    <xsl:text>(</xsl:text>    <xsl:apply-templates/>    <xsl:text>)</xsl:text>  </xsl:if></xsl:template><xsl:template match="refmiscinfo"></xsl:template><xsl:template match="refentrytitle">  <xsl:call-template name="inline.charseq"/></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:call-template>  </xsl:variable>  <xsl:variable name="reftitle">        <xsl:choose>          <xsl:when test="../refmeta/refentrytitle">            <xsl:apply-templates select="../refmeta/refentrytitle"/>          </xsl:when>          <xsl:otherwise>            <xsl:apply-templates select="refname[1]"/>          </xsl:otherwise>        </xsl:choose>  </xsl:variable>  <!-- xsl:use-attribute-sets takes only a Qname, not a variable -->    <xsl:choose>      <xsl:when test="preceding-sibling::refnamediv">	<!-- no title on secondary refnamedivs! -->      </xsl:when>      <xsl:when test="$section.level = 1">        <fo:block xsl:use-attribute-sets="refentry.title.properties">          <fo:block xsl:use-attribute-sets="section.title.level1.properties">            <xsl:value-of select="$reftitle"/>          </fo:block>        </fo:block>      </xsl:when>      <xsl:when test="$section.level = 2">        <fo:block xsl:use-attribute-sets="refentry.title.properties">          <fo:block xsl:use-attribute-sets="section.title.level2.properties">            <xsl:value-of select="$reftitle"/>          </fo:block>        </fo:block>      </xsl:when>      <xsl:when test="$section.level = 3">        <fo:block xsl:use-attribute-sets="refentry.title.properties">          <fo:block xsl:use-attribute-sets="section.title.level3.properties">            <xsl:value-of select="$reftitle"/>          </fo:block>        </fo:block>      </xsl:when>      <xsl:when test="$section.level = 4">        <fo:block xsl:use-attribute-sets="refentry.title.properties">          <fo:block xsl:use-attribute-sets="section.title.level4.properties">            <xsl:value-of select="$reftitle"/>          </fo:block>        </fo:block>      </xsl:when>      <xsl:when test="$section.level = 5">        <fo:block xsl:use-attribute-sets="refentry.title.properties">          <fo:block xsl:use-attribute-sets="section.title.level5.properties">            <xsl:value-of select="$reftitle"/>          </fo:block>        </fo:block>      </xsl:when>      <xsl:otherwise>        <fo:block xsl:use-attribute-sets="refentry.title.properties">          <fo:block xsl:use-attribute-sets="section.title.level6.properties">            <xsl:value-of select="$reftitle"/>          </fo:block>        </fo:block>      </xsl:otherwise>    </xsl:choose>    </xsl:if>    <fo:block>      <xsl:if test="not(following-sibling::refnamediv)">	<xsl:attribute name="space-after">1em</xsl:attribute>      </xsl:if>      <xsl:apply-templates/>    </fo:block>  </fo:block></xsl:template><xsl:template match="refname">  <xsl:if test="not(preceding-sibling::refdescriptor)">    <xsl:apply-templates/>    <xsl:if test="following-sibling::refname">      <xsl:text>, </xsl:text>    </xsl:if>  </xsl:if></xsl:template><xsl:template match="refpurpose">  <xsl:if test="node()">    <xsl:text> </xsl:text>    <xsl:call-template name="dingbat">      <xsl:with-param name="dingbat">em-dash</xsl:with-param>    </xsl:call-template>    <xsl:text> </xsl:text>    <xsl:apply-templates/>  </xsl:if></xsl:template><xsl:template match="refdescriptor">  <xsl:apply-templates/></xsl:template><xsl:template match="refclass">  <xsl:if test="$refclass.suppress = 0">  <fo:block font-weight="bold">    <xsl:if test="@role">      <xsl:value-of select="@role"/>      <xsl:text>: </xsl:text>    </xsl:if>    <xsl:apply-templates/>  </fo:block>  </xsl:if></xsl:template><xsl:template match="refsynopsisdiv">  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <fo:block id="{$id}">    <xsl:if test="not(refsynopsisdivinfo/title|docinfo/title|info/title|title)">      <!-- * if we there is no appropriate title for this Refsynopsisdiv, -->      <!-- * then we need to call format.refentry.subheading to generate one -->      <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"                xsl:use-attribute-sets="refsynopsisdiv.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="parent::*"/>          <xsl:with-param name="offset" select="1"/>          <xsl:with-param name="gentext.key" select="'RefSynopsisDiv'"/>        </xsl:call-template>      </fo:block>    </xsl:if>    <xsl:call-template name="refsynopsisdiv.titlepage"/>    <xsl:apply-templates/>  </fo:block></xsl:template><xsl:template match="refsection">  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <fo:block id="{$id}">    <xsl:call-template name="refsection.titlepage"/>    <xsl:apply-templates/>  </fo:block></xsl:template><xsl:template match="refsect1">  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <fo:block id="{$id}">    <xsl:call-template name="refsect1.titlepage"/>    <xsl:apply-templates/>  </fo:block></xsl:template><xsl:template match="refsect2">  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <fo:block id="{$id}">    <xsl:call-template name="refsect2.titlepage"/>    <xsl:apply-templates/>  </fo:block></xsl:template><xsl:template match="refsect3">  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <fo:block id="{$id}">    <xsl:call-template name="refsect3.titlepage"/>    <xsl:apply-templates/>  </fo:block></xsl:template><xsl:template match="refsynopsisdiv/title                     |refsection/title                     |refsect1/title                     |refsect2/title                     |refsect3/title">  <!-- nop; titlepage.mode instead --></xsl:template><xsl:template match="refsynopsisdiv/title                     |refsection/title                     |refsect1/title                     |refsect2/title                     |refsect3/title                     |refsynopsisdiv/info/title                     |refsection/info/title                     |refsect1/info/title                     |refsect2/info/title                     |refsect3/info/title"              mode="titlepage.mode"              priority="2">  <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="(ancestor::refsynopsysdiv                      |ancestor::refsection                     |ancestor::refsect1                     |ancestor::refsect2                     |ancestor::refsect3)[last()]"/>  <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:with-param name="object" select="$section"/>      </xsl:call-template>    </xsl:variable>    <xsl:variable name="level">      <xsl:call-template name="section.level">        <xsl:with-param name="node" select="$section"/>      </xsl:call-template>    </xsl:variable>    <xsl:variable name="title">      <!-- 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 + $offset}"                       fotex-bookmark-label="{$id}">        <xsl:value-of select="$title"/>      </fotex:bookmark>    </xsl:if>    <xsl:if test="$axf.extensions != 0">      <xsl:attribute name="axf:outline-level">        <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="$title"/>      </xsl:attribute>    </xsl:if>    <xsl:call-template name="section.heading">      <xsl:with-param name="level" select="$level + $offset"/>      <xsl:with-param name="title" select="$title"/>    </xsl:call-template>  </fo:block></xsl:template><xsl:template match="refsectioninfo|refsection/info"></xsl:template><xsl:template match="refsect1info|refsect1/info"></xsl:template><xsl:template match="refsect2info|refsect2/info"></xsl:template><xsl:template match="refsect3info|refsect3/info"></xsl:template><!-- ==================================================================== --></xsl:stylesheet>
 |