| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 | <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim" xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="sverb xverb lxslt exsl" 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:include href="../highlighting/common.xsl"/><xsl:include href="highlight.xsl"/><lxslt:component prefix="xverb" functions="numberLines"/><xsl:template match="programlisting|screen|synopsis">  <xsl:param name="suppress-numbers" select="'0'"/>  <xsl:variable name="id">    <xsl:call-template name="object.id"/>  </xsl:variable>  <xsl:call-template name="anchor"/>  <xsl:if test="$shade.verbatim != 0">    <xsl:message>      <xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>      <xsl:text>Use CSS instead,</xsl:text>    </xsl:message>    <xsl:message>      <xsl:text>for example: pre.</xsl:text>      <xsl:value-of select="local-name(.)"/>      <xsl:text> { background-color: #E0E0E0; }</xsl:text>    </xsl:message>  </xsl:if>  <xsl:choose>    <xsl:when test="$suppress-numbers = '0'       and @linenumbering = 'numbered'       and $use.extensions != '0'       and $linenumbering.extension != '0'">      <xsl:variable name="rtf">	<xsl:call-template name="apply-highlighting"/>      </xsl:variable>      <pre>        <xsl:apply-templates select="." mode="class.attribute"/>	<xsl:call-template name="number.rtf.lines">	  <xsl:with-param name="rtf" select="$rtf"/>	</xsl:call-template>      </pre>    </xsl:when>    <xsl:otherwise>      <pre>        <xsl:apply-templates select="." mode="class.attribute"/>	<xsl:call-template name="apply-highlighting"/>      </pre>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template match="literallayout">  <xsl:param name="suppress-numbers" select="'0'"/>  <xsl:variable name="rtf">    <xsl:apply-templates/>  </xsl:variable>  <xsl:if test="$shade.verbatim != 0 and @class='monospaced'">    <xsl:message>      <xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>      <xsl:text>Use CSS instead,</xsl:text>    </xsl:message>    <xsl:message>      <xsl:text>for example: pre.</xsl:text>      <xsl:value-of select="local-name(.)"/>      <xsl:text> { background-color: #E0E0E0; }</xsl:text>    </xsl:message>  </xsl:if>  <xsl:choose>    <xsl:when test="$suppress-numbers = '0'       and @linenumbering = 'numbered'       and $use.extensions != '0'       and $linenumbering.extension != '0'">      <xsl:choose>	<xsl:when test="@class='monospaced'">          <pre>            <xsl:apply-templates select="." mode="class.attribute"/>	    <xsl:call-template name="number.rtf.lines">	      <xsl:with-param name="rtf" select="$rtf"/>	    </xsl:call-template>	  </pre>	</xsl:when>	<xsl:otherwise>          <div>            <xsl:apply-templates select="." mode="class.attribute"/>	    <p>	      <xsl:call-template name="number.rtf.lines">		<xsl:with-param name="rtf" select="$rtf"/>	      </xsl:call-template>	    </p>	  </div>	</xsl:otherwise>      </xsl:choose>    </xsl:when>    <xsl:otherwise>      <xsl:choose>	<xsl:when test="@class='monospaced'">          <pre>            <xsl:apply-templates select="." mode="class.attribute"/>	    <xsl:copy-of select="$rtf"/>	  </pre>	</xsl:when>	<xsl:otherwise>          <div>            <xsl:apply-templates select="." mode="class.attribute"/>	    <p>	      <xsl:call-template name="make-verbatim">		<xsl:with-param name="rtf" select="$rtf"/>	      </xsl:call-template>	    </p>	  </div>	</xsl:otherwise>      </xsl:choose>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template match="address">  <xsl:param name="suppress-numbers" select="'0'"/>  <xsl:variable name="rtf">    <xsl:apply-templates/>  </xsl:variable>  <xsl:choose>    <xsl:when test="$suppress-numbers = '0'                     and @linenumbering = 'numbered'                     and $use.extensions != '0'                     and $linenumbering.extension != '0'">      <div>        <xsl:apply-templates select="." mode="class.attribute"/>        <p>          <xsl:call-template name="number.rtf.lines">            <xsl:with-param name="rtf" select="$rtf"/>          </xsl:call-template>        </p>      </div>    </xsl:when>    <xsl:otherwise>      <div>        <xsl:apply-templates select="." mode="class.attribute"/>        <p>          <xsl:call-template name="make-verbatim">            <xsl:with-param name="rtf" select="$rtf"/>          </xsl:call-template>        </p>      </div>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template name="number.rtf.lines">  <xsl:param name="rtf" select="''"/>  <xsl:param name="pi.context" select="."/>  <!-- Save the global values -->  <xsl:variable name="global.linenumbering.everyNth" select="$linenumbering.everyNth"/>  <xsl:variable name="global.linenumbering.separator" select="$linenumbering.separator"/>  <xsl:variable name="global.linenumbering.width" select="$linenumbering.width"/>  <!-- Extract the <?dbhtml linenumbering.*?> PI values -->  <xsl:variable name="pi.linenumbering.everyNth">    <xsl:call-template name="pi.dbhtml_linenumbering.everyNth">      <xsl:with-param name="node" select="$pi.context"/>    </xsl:call-template>  </xsl:variable>  <xsl:variable name="pi.linenumbering.separator">    <xsl:call-template name="pi.dbhtml_linenumbering.separator">      <xsl:with-param name="node" select="$pi.context"/>    </xsl:call-template>  </xsl:variable>  <xsl:variable name="pi.linenumbering.width">    <xsl:call-template name="pi.dbhtml_linenumbering.width">      <xsl:with-param name="node" select="$pi.context"/>    </xsl:call-template>  </xsl:variable>  <!-- Construct the 'in-context' values -->  <xsl:variable name="linenumbering.everyNth">    <xsl:choose>      <xsl:when test="$pi.linenumbering.everyNth != ''">        <xsl:value-of select="$pi.linenumbering.everyNth"/>      </xsl:when>      <xsl:otherwise>        <xsl:value-of select="$global.linenumbering.everyNth"/>      </xsl:otherwise>    </xsl:choose>  </xsl:variable>  <xsl:variable name="linenumbering.separator">    <xsl:choose>      <xsl:when test="$pi.linenumbering.separator != ''">        <xsl:value-of select="$pi.linenumbering.separator"/>      </xsl:when>      <xsl:otherwise>        <xsl:value-of select="$global.linenumbering.separator"/>      </xsl:otherwise>    </xsl:choose>  </xsl:variable>  <xsl:variable name="linenumbering.width">    <xsl:choose>      <xsl:when test="$pi.linenumbering.width != ''">        <xsl:value-of select="$pi.linenumbering.width"/>      </xsl:when>      <xsl:otherwise>        <xsl:value-of select="$global.linenumbering.width"/>      </xsl:otherwise>    </xsl:choose>  </xsl:variable>  <xsl:variable name="linenumbering.startinglinenumber">    <xsl:choose>      <xsl:when test="$pi.context/@startinglinenumber">        <xsl:value-of select="$pi.context/@startinglinenumber"/>      </xsl:when>      <xsl:when test="$pi.context/@continuation='continues'">        <xsl:variable name="lastLine">          <xsl:choose>            <xsl:when test="$pi.context/self::programlisting">              <xsl:call-template name="lastLineNumber">                <xsl:with-param name="listings" select="preceding::programlisting[@linenumbering='numbered']"/>              </xsl:call-template>            </xsl:when>            <xsl:when test="$pi.context/self::screen">              <xsl:call-template name="lastLineNumber">                <xsl:with-param name="listings" select="preceding::screen[@linenumbering='numbered']"/>              </xsl:call-template>            </xsl:when>            <xsl:when test="$pi.context/self::literallayout">              <xsl:call-template name="lastLineNumber">                <xsl:with-param name="listings" select="preceding::literallayout[@linenumbering='numbered']"/>              </xsl:call-template>            </xsl:when>            <xsl:when test="$pi.context/self::address">              <xsl:call-template name="lastLineNumber">                <xsl:with-param name="listings" select="preceding::address[@linenumbering='numbered']"/>              </xsl:call-template>            </xsl:when>            <xsl:when test="$pi.context/self::synopsis">              <xsl:call-template name="lastLineNumber">                <xsl:with-param name="listings" select="preceding::synopsis[@linenumbering='numbered']"/>              </xsl:call-template>            </xsl:when>            <xsl:otherwise>              <xsl:message>                <xsl:text>Unexpected verbatim environment: </xsl:text>                <xsl:value-of select="local-name($pi.context)"/>              </xsl:message>              <xsl:value-of select="0"/>            </xsl:otherwise>          </xsl:choose>        </xsl:variable>        <xsl:value-of select="$lastLine + 1"/>      </xsl:when>      <xsl:otherwise>1</xsl:otherwise>    </xsl:choose>  </xsl:variable>  <xsl:choose>    <xsl:when test="function-available('sverb:numberLines')">      <xsl:copy-of select="sverb:numberLines($rtf)"/>    </xsl:when>    <xsl:when test="function-available('xverb:numberLines')">      <xsl:copy-of select="xverb:numberLines($rtf)"/>    </xsl:when>    <xsl:otherwise>      <xsl:message terminate="yes">        <xsl:text>No numberLines function available.</xsl:text>      </xsl:message>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template name="make-verbatim">  <xsl:param name="rtf"/>  <!-- I want to make this RTF verbatim. There are two possibilities: either       I have access to the exsl:node-set extension function and I can "do it right"       or I have to rely on CSS. -->  <xsl:choose>    <xsl:when test="function-available('exsl:node-set')">      <xsl:apply-templates select="exsl:node-set($rtf)" mode="make.verbatim.mode"/>    </xsl:when>    <xsl:otherwise>      <span style="white-space: pre;">        <xsl:copy-of select="$rtf"/>      </span>    </xsl:otherwise>  </xsl:choose></xsl:template><!-- ======================================================================== --><xsl:template name="lastLineNumber">  <xsl:param name="listings"/>  <xsl:param name="number" select="0"/>  <xsl:variable name="lines">    <xsl:call-template name="countLines">      <xsl:with-param name="listing" select="string($listings[1])"/>    </xsl:call-template>  </xsl:variable>  <xsl:choose>    <xsl:when test="not($listings)">      <xsl:value-of select="$number"/>    </xsl:when>    <xsl:when test="$listings[1]/@startinglinenumber">      <xsl:value-of select="$number + $listings[1]/@startinglinenumber + $lines - 1"/>    </xsl:when>    <xsl:when test="$listings[1]/@continuation='continues'">      <xsl:call-template name="lastLineNumber">        <xsl:with-param name="listings" select="listings[position() > 1]"/>        <xsl:with-param name="number" select="$number + $lines"/>      </xsl:call-template>    </xsl:when>    <xsl:otherwise>      <xsl:value-of select="$lines"/>    </xsl:otherwise>  </xsl:choose></xsl:template><xsl:template name="countLines">  <xsl:param name="listing"/>  <xsl:param name="count" select="1"/>  <xsl:choose>    <xsl:when test="contains($listing, '
')">      <xsl:call-template name="countLines">        <xsl:with-param name="listing" select="substring-after($listing, '
')"/>        <xsl:with-param name="count" select="$count + 1"/>      </xsl:call-template>    </xsl:when>    <xsl:otherwise>      <xsl:value-of select="$count"/>    </xsl:otherwise>  </xsl:choose></xsl:template></xsl:stylesheet>
 |