Blame xslt/common/titles.xsl

Packit e4b6da
Packit e4b6da
Packit e4b6da
-->
Packit e4b6da
Packit e4b6da
                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
Packit e4b6da
                exclude-result-prefixes="doc"
Packit e4b6da
                version='1.0'
Packit e4b6da
                xml:lang="en">
Packit e4b6da
Packit e4b6da
Packit e4b6da
     $Id: titles.xsl,v 1.11 2004/08/04 02:05:40 stevecheng Exp $
Packit e4b6da
     ********************************************************************
Packit e4b6da
Packit e4b6da
     © 2000 Steve Cheng <stevecheng@users.sourceforge.net>
Packit e4b6da
Packit e4b6da
     Part of docbook2X.  title mode.  Will need to go over this
Packit e4b6da
     code.
Packit e4b6da
Packit e4b6da
     ********************************************************************
Packit e4b6da
-->
Packit e4b6da
		
Packit e4b6da
Packit e4b6da
Packit e4b6da
Packit e4b6da
<doc:mode mode="for-title" xmlns="">
Packit e4b6da
<refpurpose>Provides access to element titles</refpurpose>
Packit e4b6da
<refdescription>
Packit e4b6da
<para>Processing an element in the
Packit e4b6da
<literal role="mode">title</literal> mode produces the
Packit e4b6da
title of the element. This does not include the label.
Packit e4b6da
</para>
Packit e4b6da
</refdescription>
Packit e4b6da
</doc:mode>
Packit e4b6da
Packit e4b6da
<xsl:template match="title" mode="title">
Packit e4b6da
  <xsl:apply-templates mode="title" />
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="*" mode="title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="$allow-anchors">
Packit e4b6da
      <xsl:apply-templates />
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:apply-templates mode="no-anchors" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="text()" mode="title">
Packit e4b6da
  <xsl:value-of select="." />
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
Packit e4b6da
Packit e4b6da
<xsl:template match="set" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
                       mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="*" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:param name="suppress-error" select="false()" />
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="title">
Packit e4b6da
      <xsl:apply-templates select="title[1]" mode="title">
Packit e4b6da
	<xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
Packit e4b6da
    <xsl:when test="$suppress-error">
Packit e4b6da
    </xsl:when>
Packit e4b6da
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="user-message">
Packit e4b6da
        <xsl:with-param name="key">Erroneous request for title for this element</xsl:with-param>
Packit e4b6da
      </xsl:call-template>
Packit e4b6da
Packit e4b6da
      <xsl:call-template name="gentext-text">
Packit e4b6da
        <xsl:with-param name="key">[missing text]</xsl:with-param>
Packit e4b6da
      </xsl:call-template>
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="book" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
                       mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="part" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
                       mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="preface|chapter|appendix" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
Packit e4b6da
  
Packit e4b6da
                                      |prefaceinfo/title
Packit e4b6da
                                      |chapterinfo/title
Packit e4b6da
                                      |appendixinfo/title
Packit e4b6da
                                      |title)[1]"/>
Packit e4b6da
  <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="partintro" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
       title instead. -->
Packit e4b6da
  <xsl:apply-templates select="parent::*" mode="for-title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="dedication" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="title">
Packit e4b6da
      <xsl:apply-templates select="title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="colophon" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="title">
Packit e4b6da
      <xsl:apply-templates select="title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="article" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
                                      |articleinfo/title
Packit e4b6da
                                      |title)[1]"/>
Packit e4b6da
Packit e4b6da
  <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="reference" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
                       mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="refentry" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()"/>
Packit e4b6da
  <xsl:variable name="refmeta" select=".//refmeta"/>
Packit e4b6da
  <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
Packit e4b6da
  <xsl:variable name="refnamediv" select=".//refnamediv"/>
Packit e4b6da
  <xsl:variable name="refname" select="$refnamediv//refname"/>
Packit e4b6da
Packit e4b6da
  <xsl:variable name="title">
Packit e4b6da
    <xsl:choose>
Packit e4b6da
      <xsl:when test="$refentrytitle">
Packit e4b6da
        <xsl:apply-templates select="$refentrytitle[1]" mode="title">
Packit e4b6da
          <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
        </xsl:apply-templates>
Packit e4b6da
      </xsl:when>
Packit e4b6da
      <xsl:when test="$refname">
Packit e4b6da
        <xsl:apply-templates select="$refname[1]" mode="title">
Packit e4b6da
          <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
        </xsl:apply-templates>
Packit e4b6da
      </xsl:when>
Packit e4b6da
Packit e4b6da
      <xsl:otherwise>
Packit e4b6da
        <xsl:call-template name="user-message">
Packit e4b6da
          <xsl:with-param name="key">refentry has no title</xsl:with-param>
Packit e4b6da
        </xsl:call-template>
Packit e4b6da
Packit e4b6da
        <xsl:call-template name="gentext-text">
Packit e4b6da
          <xsl:with-param name="key">No title</xsl:with-param>
Packit e4b6da
        </xsl:call-template>
Packit e4b6da
      </xsl:otherwise>
Packit e4b6da
    </xsl:choose>
Packit e4b6da
  </xsl:variable>
Packit e4b6da
Packit e4b6da
  <xsl:copy-of select="$title"/>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
Packit e4b6da
<xsl:template match="refsynopsisdiv" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()"/>
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="./title">
Packit e4b6da
      <xsl:apply-templates select="./title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
 
Packit e4b6da
Packit e4b6da
Packit e4b6da
                     |sect1|sect2|sect3|sect4|sect5
Packit e4b6da
                     |refsect1|refsect2|refsect3
Packit e4b6da
                     |simplesect"
Packit e4b6da
              mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  
Packit e4b6da
                                      |sect1info/title
Packit e4b6da
                                      |sect2info/title
Packit e4b6da
                                      |sect3info/title
Packit e4b6da
                                      |sect4info/title
Packit e4b6da
                                      |sect5info/title
Packit e4b6da
                                      |refsect1info/title
Packit e4b6da
                                      |refsect2info/title
Packit e4b6da
                                      |refsect3info/title
Packit e4b6da
                                      |title)[1]"/>
Packit e4b6da
Packit e4b6da
  <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="bibliography" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:variable name="title" select="(bibliographyinfo/title|title)[1]"/>
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="$title">
Packit e4b6da
      <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="glossary" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:variable name="title" select="(glossaryinfo/title|title)[1]"/>
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="$title">
Packit e4b6da
      <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="index" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:variable name="title" select="(indexinfo/title|title)[1]"/>
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="$title">
Packit e4b6da
      <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="figure|table|example|equation" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:apply-templates select="title" mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="qandaset|qandadiv" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()"/>
Packit e4b6da
  <xsl:apply-templates select="title" mode="title">
Packit e4b6da
    <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
  </xsl:apply-templates>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="abstract" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="title">
Packit e4b6da
      <xsl:apply-templates select="title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="caution|tip|warning|important|note" mode="for-title">
Packit e4b6da
  <xsl:param name="allow-anchors" select="false()" />
Packit e4b6da
  <xsl:variable name="title" select="title[1]"/>
Packit e4b6da
  <xsl:choose>
Packit e4b6da
    <xsl:when test="$title">
Packit e4b6da
      <xsl:apply-templates select="$title" mode="title">
Packit e4b6da
        <xsl:with-param name="allow-anchors" select="$allow-anchors" />
Packit e4b6da
      </xsl:apply-templates>
Packit e4b6da
    </xsl:when>
Packit e4b6da
    <xsl:otherwise>
Packit e4b6da
      <xsl:call-template name="gentext-title" />
Packit e4b6da
    </xsl:otherwise>
Packit e4b6da
  </xsl:choose>
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
Packit e4b6da
Packit e4b6da
Packit e4b6da
Packit e4b6da
<xsl:template match="*" mode="no-anchors">
Packit e4b6da
  <xsl:apply-templates select="." />
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="footnote" mode="no-anchors">
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="anchor" mode="no-anchors">
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="ulink" mode="no-anchors">
Packit e4b6da
  <xsl:apply-templates />
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="link" mode="no-anchors">
Packit e4b6da
  <xsl:apply-templates />
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="olink" mode="no-anchors">
Packit e4b6da
  <xsl:apply-templates />
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="indexterm" mode="no-anchors">
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
<xsl:template match="xref" mode="no-anchors">
Packit e4b6da
  
Packit e4b6da
</xsl:template>
Packit e4b6da
Packit e4b6da
Packit e4b6da
Packit e4b6da
</xsl:stylesheet>
Packit e4b6da