File: length-magnitude.html

package info (click to toggle)
docbook-xsl-doc 1.75.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,848 kB
  • ctags: 3,038
  • sloc: makefile: 34; sh: 5
file content (31 lines) | stat: -rw-r--r-- 3,356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>length-magnitude</title><link rel="stylesheet" href="reference.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="../index.html" title="DocBook XSL Stylesheets: ReferenceDocumentation"><link rel="up" href="generallibrary.html" title="General Library Templates"><link rel="prev" href="xpointer.idref.html" title="xpointer.idref"><link rel="next" href="length-units.html" title="length-units"><link rel="copyright" href="copyright.html" title="License"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">length-magnitude</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="xpointer.idref.html">Prev</a></td><th width="60%" align="center">General Library Templates</th><td width="20%" align="right"><a accesskey="n" href="length-units.html">Next</a></td></tr></table><hr></div><div class="refentry" title="length-magnitude"><a name="length-magnitude"></a><div class="titlepage"></div>
<div class="refnamediv"><h2>length-magnitude</h2><p>
length-magnitude
 &#8212; Return the unqualified dimension from a length specification
</p></div>

<div class="refsect1" title="Description"><a name="id1456271"></a><h2>Description</h2>

<p>The <code class="function">length-magnitude</code> template returns the
unqualified length ("20" for "20pt") from a dimension.
</p>

<a name="length-magnitude.frag"></a><pre class="programlisting">
&lt;xsl:template name="length-magnitude"&gt;
  &lt;xsl:param name="length" select="'0pt'"&gt;&lt;/xsl:param&gt;

  &lt;xsl:choose&gt;
    &lt;xsl:when test="string-length($length) = 0"&gt;&lt;/xsl:when&gt;
    &lt;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) = '.'"&gt;
      &lt;xsl:value-of select="substring($length,1,1)"&gt;&lt;/xsl:value-of&gt;
      &lt;xsl:call-template name="length-magnitude"&gt;
        &lt;xsl:with-param name="length" select="substring($length,2)"&gt;&lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
    &lt;/xsl:when&gt;
  &lt;/xsl:choose&gt;
&lt;/xsl:template&gt;
</pre>

</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="xpointer.idref.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="generallibrary.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="length-units.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">xpointer.idref</td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top">length-units</td></tr></table></div></body></html>