blob: de0de6a2c7ae6b11dcd96babff4407110e777121 (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>length-spec</title><link rel="stylesheet" type="text/css" href="../reference.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="../index.html" title="DocBook XSL Stylesheets: Reference Documentation"><link rel="up" href="generallibrary.html" title="General Library Templates"><link rel="prev" href="length-units.html" title="length-units"><link rel="next" href="length-in-points.html" title="length-in-points"><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-spec</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="length-units.html">Prev</a> </td><th width="60%" align="center">General Library Templates</th><td width="20%" align="right"> <a accesskey="n" href="length-in-points.html">Next</a></td></tr></table><hr></div><div class="refentry" title="length-spec"><a name="length-spec"></a><div class="titlepage"></div>
<div class="refnamediv"><h2>length-spec</h2><p>
length-spec
— Return a fully qualified length specification
</p></div>
<div class="refsect1" title="Description"><a name="id36258277"></a><h2>Description</h2>
<p>The <code class="function">length-spec</code> template returns the
qualified length from a dimension. If an unqualified length is given,
the <a href="../fo/default.units.html"><em class="parameter"><code>default.units</code></em></a> will be added to it.
</p>
<a name="length-spec.frag"></a><pre class="programlisting">
<xsl:template name="length-spec">
<xsl:param name="length" select="'0pt'"></xsl:param>
<xsl:param name="default.units" select="'px'"></xsl:param>
<xsl:variable name="magnitude">
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="$length"></xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="units">
<xsl:value-of select="substring($length, string-length($magnitude)+1)"></xsl:value-of>
</xsl:variable>
<xsl:value-of select="$magnitude"></xsl:value-of>
<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:value-of>
</xsl:when>
<xsl:when test="$units = ''">
<xsl:value-of select="$default.units"></xsl:value-of>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unrecognized unit of measure: </xsl:text>
<xsl:value-of select="$units"></xsl:value-of>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</pre>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="length-units.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-in-points.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">length-units </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> length-in-points</td></tr></table></div></body></html>
|