| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 | <?xml version='1.0' encoding='ISO-8859-1'?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                xmlns="http://www.w3.org/1999/xhtml"                version="1.0">    <!-- para -->  <xsl:template match="para">    <xsl:choose>      <xsl:when test="child::ulink[@url=' ']"/>      <xsl:otherwise>        <xsl:call-template name="paragraph">          <xsl:with-param name="class">            <xsl:if test="@role and $para.propagates.style != 0">              <xsl:value-of select="@role"/>            </xsl:if>          </xsl:with-param>          <xsl:with-param name="content">            <xsl:if test="position() = 1 and parent::listitem">              <xsl:call-template name="anchor">                <xsl:with-param name="node" select="parent::listitem"/>              </xsl:call-template>            </xsl:if>            <xsl:call-template name="anchor"/>            <xsl:apply-templates/>          </xsl:with-param>        </xsl:call-template>      </xsl:otherwise>    </xsl:choose>  </xsl:template>    <!-- screen -->  <xsl:template match="screen">    <xsl:choose>      <xsl:when test="child::* = userinput">        <pre class="userinput">            <xsl:apply-templates/>        </pre>      </xsl:when>      <xsl:otherwise>        <pre class="{name(.)}">          <xsl:apply-templates/>        </pre>      </xsl:otherwise>    </xsl:choose>  </xsl:template>  <xsl:template match="userinput">    <xsl:choose>      <xsl:when test="ancestor::screen">        <kbd class="command">          <xsl:apply-templates/>        </kbd>      </xsl:when>      <xsl:otherwise>        <xsl:apply-imports/>      </xsl:otherwise>    </xsl:choose>  </xsl:template>    <!-- segementedlist -->  <xsl:template match="seg">    <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>    <xsl:variable name="seglist" select="ancestor::segmentedlist"/>    <xsl:variable name="segtitles" select="$seglist/segtitle"/>      <!-- Note: segtitle is only going to be the right thing in a well formed      SegmentedList.  If there are too many Segs or too few SegTitles,      you'll get something odd...maybe an error -->      <div class="seg">      <strong>        <span class="segtitle">          <xsl:apply-templates select="$segtitles[$segnum=position()]" mode="segtitle-in-seg"/>          <xsl:text>: </xsl:text>        </span>      </strong>      <span class="seg">        <xsl:apply-templates/>      </span>    </div>  </xsl:template>  <!-- variablelist -->  <xsl:template match="variablelist">    <xsl:choose>      <xsl:when test="@role">        <div class="{@role}">          <xsl:apply-imports/>        </div>      </xsl:when>      <xsl:otherwise>        <xsl:apply-imports/>      </xsl:otherwise>    </xsl:choose>  </xsl:template>    <!-- Body attributes -->  <xsl:template name="body.attributes">    <xsl:attribute name="id">      <xsl:text>lfs</xsl:text>    </xsl:attribute>    <xsl:attribute name="class">      <xsl:value-of select="substring-after(/book/bookinfo/subtitle, ' ')"/>    </xsl:attribute>  </xsl:template>    <!-- External URLs in italic font -->  <xsl:template match="ulink" name="ulink">    <a>      <xsl:if test="@id">        <xsl:attribute name="id">          <xsl:value-of select="@id"/>        </xsl:attribute>      </xsl:if>      <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>       <i>        <xsl:choose>          <xsl:when test="count(child::node())=0">            <xsl:value-of select="@url"/>          </xsl:when>          <xsl:otherwise>            <xsl:apply-templates/>          </xsl:otherwise>        </xsl:choose>      </i>    </a>  </xsl:template>    <!-- The <code> xhtml tag have look issues in some browsers, like Konqueror and.      isn't semantically correct (a filename isn't a code fragment) We will use <tt> for now. -->  <xsl:template name="inline.monoseq">    <xsl:param name="content">      <xsl:call-template name="anchor"/>      <xsl:call-template name="simple.xlink">        <xsl:with-param name="content">          <xsl:apply-templates/>        </xsl:with-param>      </xsl:call-template>    </xsl:param>    <tt class="{local-name(.)}">      <xsl:if test="@dir">        <xsl:attribute name="dir">          <xsl:value-of select="@dir"/>        </xsl:attribute>      </xsl:if>      <xsl:copy-of select="$content"/>    </tt>  </xsl:template>  <xsl:template name="inline.boldmonoseq">    <xsl:param name="content">      <xsl:call-template name="anchor"/>      <xsl:call-template name="simple.xlink">        <xsl:with-param name="content">          <xsl:apply-templates/>        </xsl:with-param>      </xsl:call-template>    </xsl:param>    <!-- don't put <strong> inside figure, example, or table titles -->    <!-- or other titles that may already be represented with <strong>'s. -->    <xsl:choose>      <xsl:when test="local-name(..) = 'title' and (local-name(../..) = 'figure'              or local-name(../..) = 'example' or local-name(../..) = 'table' or local-name(../..) = 'formalpara')">        <tt class="{local-name(.)}">          <xsl:if test="@dir">            <xsl:attribute name="dir">              <xsl:value-of select="@dir"/>            </xsl:attribute>          </xsl:if>          <xsl:copy-of select="$content"/>        </tt>      </xsl:when>      <xsl:otherwise>        <strong class="{local-name(.)}">          <tt>            <xsl:if test="@dir">              <xsl:attribute name="dir">                <xsl:value-of select="@dir"/>              </xsl:attribute>            </xsl:if>            <xsl:copy-of select="$content"/>          </tt>        </strong>      </xsl:otherwise>    </xsl:choose>  </xsl:template>  <xsl:template name="inline.italicmonoseq">    <xsl:param name="content">      <xsl:call-template name="anchor"/>      <xsl:call-template name="simple.xlink">        <xsl:with-param name="content">          <xsl:apply-templates/>        </xsl:with-param>      </xsl:call-template>    </xsl:param>    <em class="{local-name(.)}">      <tt>        <xsl:if test="@dir">          <xsl:attribute name="dir">            <xsl:value-of select="@dir"/>          </xsl:attribute>        </xsl:if>        <xsl:copy-of select="$content"/>      </tt>    </em>  </xsl:template>    <!-- Total packages size calculation -->  <xsl:template match="returnvalue">    <xsl:call-template name="calculation">     <xsl:with-param name="scope" select="../../variablelist"/>    </xsl:call-template>  </xsl:template>  <xsl:template name="calculation">    <xsl:param name="scope"/>    <xsl:param name="total">0</xsl:param>    <xsl:param name="position">1</xsl:param>    <xsl:variable name="tokens" select="count($scope/varlistentry)"/>    <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>    <xsl:variable name="size" select="substring-before($token,' KB')"/>    <xsl:variable name="rawsize">      <xsl:choose>        <xsl:when test="contains($size,',')">          <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>        </xsl:when>        <xsl:otherwise>          <xsl:value-of select="$size"/>        </xsl:otherwise>      </xsl:choose>    </xsl:variable>    <xsl:choose>      <xsl:when test="$position <= $tokens">        <xsl:call-template name="calculation">          <xsl:with-param name="scope" select="$scope"/>          <xsl:with-param name="position" select="$position +1"/>          <xsl:with-param name="total" select="$total + $rawsize"/>        </xsl:call-template>      </xsl:when>      <xsl:otherwise>        <xsl:choose>          <xsl:when test="$total < '1000'">            <xsl:value-of select="$total"/>            <xsl:text>  KB</xsl:text>          </xsl:when>          <xsl:when test="$total > '1000' and $total < '5000'">            <xsl:value-of select="substring($total,1,1)"/>            <xsl:text>,</xsl:text>            <xsl:value-of select="substring($total,2)"/>            <xsl:text>  KB</xsl:text>          </xsl:when>          <xsl:otherwise>            <xsl:value-of select="round($total div 1024)"/>            <xsl:text>  MB</xsl:text>          </xsl:otherwise>        </xsl:choose>      </xsl:otherwise>    </xsl:choose>  </xsl:template></xsl:stylesheet>
 |