User: tobias  
  Date: 01/03/11 17:13:32

  Modified:    src/docs/docbook/lib lib.xsl
  Log:
  updated to newest version. Missed some files on last commit. Here they are.
  
  Revision  Changes    Path
  1.2       +120 -2    manual/src/docs/docbook/lib/lib.xsl
  
  Index: lib.xsl
  ===================================================================
  RCS file: /products/cvs/ejboss/manual/src/docs/docbook/lib/lib.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- lib.xsl   2001/02/11 00:05:27     1.1
  +++ lib.xsl   2001/03/12 01:13:32     1.2
  @@ -5,7 +5,7 @@
                   version='1.0'>
   
   <!-- ********************************************************************
  -     $Id: lib.xsl,v 1.1 2001/02/11 00:05:27 tobias Exp $
  +     $Id: lib.xsl,v 1.2 2001/03/12 01:13:32 tobias Exp $
        ********************************************************************
   
        This file is part of the XSL DocBook Stylesheet distribution.
  @@ -19,7 +19,7 @@
   <doc:reference xmlns="">
   <referenceinfo>
   <releaseinfo role="meta">
  -$Id: lib.xsl,v 1.1 2001/02/11 00:05:27 tobias Exp $
  +$Id: lib.xsl,v 1.2 2001/03/12 01:13:32 tobias Exp $
   </releaseinfo>
   <author><surname>Walsh</surname>
   <firstname>Norman</firstname></author>
  @@ -89,6 +89,43 @@
     </xsl:choose>
   </xsl:template>
   
  +<!-- ====================================================================== -->
  +
  +<doc:template name="string.subst" xmlns="">
  +<refpurpose>Substitute one text string for another in a string</refpurpose>
  +<refdescription>
  +<para>The <function>string.subst</function> template replaces all
  +occurances of <param>target</param> in <param>string</param>
  +with <param>replacement</param> and returns the result.
  +</para>
  +</refdescription>
  +</doc:template>
  +
  +<xsl:template name="string.subst">
  +  <xsl:param name="string"></xsl:param>
  +  <xsl:param name="target"></xsl:param>
  +  <xsl:param name="replacement"></xsl:param>
  +
  +  <xsl:choose>
  +    <xsl:when test="contains($string, $target)">
  +      <xsl:variable name="rest">
  +        <xsl:call-template name="string.subst">
  +          <xsl:with-param name="string"
  +                          select="substring-after($string, $target)"/>
  +          <xsl:with-param name="target" select="$target"/>
  +          <xsl:with-param name="replacement" select="$replacement"/>
  +        </xsl:call-template>
  +      </xsl:variable>
  +      <xsl:value-of select="concat(substring-before($string, $target),
  +                                   $replacement,
  +                                   $rest)"/>
  +    </xsl:when>
  +    <xsl:otherwise>
  +      <xsl:value-of select="$string"/>
  +    </xsl:otherwise>
  +  </xsl:choose>
  +</xsl:template>
  +
   <!-- ================================================================== -->
   
   <doc:template name="xpointer.idref" xmlns="">
  @@ -120,5 +157,86 @@
   </xsl:template>
   
   <!-- ================================================================== -->
  +
  +<doc:template name="length-magnitude" xmlns="">
  +<refpurpose>Return the unqualified dimension from a length 
specification</refpurpose>
  +<refdescription>
  +<para>The <function>length-magnitude</function> template returns the
  +unqualified length ("20" for "20pt") from a dimension.
  +</para>
  +</refdescription>
  +</doc:template>
  +
  +<xsl:template name="length-magnitude">
  +  <xsl:param name="length" select="'0pt'"/>
  +
  +  <xsl:choose>
  +    <xsl:when test="string-length($length) = 0"/>
  +    <xsl:when test="substring($length,1,1) = '0'
  +                    or substring($length,1,1) = '1'
  +                    or substring($length,1,1) = '2'
  +                    or substring($length,1,1) = '3'
  +                    or substring($length,1,1) = '4'
  +                    or substring($length,1,1) = '5'
  +                    or substring($length,1,1) = '6'
  +                    or substring($length,1,1) = '7'
  +                    or substring($length,1,1) = '8'
  +                    or substring($length,1,1) = '9'
  +                    or substring($length,1,1) = '.'">
  +      <xsl:value-of select="substring($length,1,1)"/>
  +      <xsl:call-template name="length-magnitude">
  +        <xsl:with-param name="length" select="substring($length,2)"/>
  +      </xsl:call-template>
  +    </xsl:when>
  +  </xsl:choose>
  +</xsl:template>
  +
  +<!-- ================================================================== -->
  +
  +<doc:template name="length-spec" xmlns="">
  +<refpurpose>Return a fully qualified length specification</refpurpose>
  +<refdescription>
  +<para>The <function>length-spec</function> template returns the
  +qualified length from a dimension. If an unqualified length is given,
  +the <param>default.units</param> will be added to it.
  +</para>
  +</refdescription>
  +</doc:template>
  +
  +<xsl:template name="length-spec">
  +  <xsl:param name="length" select="'0pt'"/>
  +  <xsl:param name="default.units" select="'pt'"/>
  +  <xsl:variable name="magnitude">
  +    <xsl:call-template name="length-magnitude">
  +      <xsl:with-param name="length" select="$length"/>
  +    </xsl:call-template>
  +  </xsl:variable>
  +  <xsl:variable name="units">
  +    <xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
  +  </xsl:variable>
  +
  +  <xsl:value-of select="$magnitude"/>
  +  <xsl:choose>
  +    <xsl:when test="$units='cm'
  +                    or $units='mm'
  +                    or $units='in'
  +                    or $units='pt'
  +                    or $units='pc'
  +                    or $units='px'
  +                    or $units='em'">
  +      <xsl:value-of select="$units"/>
  +    </xsl:when>
  +    <xsl:when test="$units = ''">
  +      <xsl:value-of select="$default.units"/>
  +    </xsl:when>
  +    <xsl:otherwise>
  +      <xsl:message>
  +        <xsl:text>Unrecognized unit of measure: </xsl:text>
  +        <xsl:value-of select="$units"/>
  +        <xsl:text>.</xsl:text>
  +      </xsl:message>
  +    </xsl:otherwise>
  +  </xsl:choose>
  +</xsl:template>
   
   </xsl:stylesheet>
  
  
  

Reply via email to