Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 9f452694b2d23dacae7f9cc757f9be50 > files > 922

docbook-style-xsl-1.78.1-1.fc17.noarch.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>copy-string</title><link rel="stylesheet" type="text/css" href="../reference.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.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="dot.count.html" title="dot.count"><link rel="next" href="string.subst.html" title="string.subst"><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">copy-string</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dot.count.html">Prev</a> </td><th width="60%" align="center">General Library Templates</th><td width="20%" align="right"> <a accesskey="n" href="string.subst.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="copy-string"></a><div class="titlepage"></div>
<div class="refnamediv"><h2>copy-string</h2><p>
copy-string
 &#8212; Returns <span class="quote">&#8220;<span class="quote">count</span>&#8221;</span> copies of a string
</p></div>

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

  <p>Given a string, the <code class="function">copy-string</code>
    template creates <em class="replaceable"><code>n</code></em> copies of the
    string, when the value of <em class="replaceable"><code>n</code></em> is
    given by the <em class="parameter"><code>count</code></em> parameter.</p>

<a name="copy-string.frag"></a><pre class="programlisting">
&lt;xsl:template name="copy-string"&gt;
  &lt;!-- returns 'count' copies of 'string' --&gt;
  &lt;xsl:param name="string"&gt;&lt;/xsl:param&gt;
  &lt;xsl:param name="count" select="0"&gt;&lt;/xsl:param&gt;
  &lt;xsl:param name="result"&gt;&lt;/xsl:param&gt;

  &lt;xsl:choose&gt;
    &lt;xsl:when test="$count&gt;0"&gt;
      &lt;xsl:call-template name="copy-string"&gt;
        &lt;xsl:with-param name="string" select="$string"&gt;&lt;/xsl:with-param&gt;
        &lt;xsl:with-param name="count" select="$count - 1"&gt;&lt;/xsl:with-param&gt;
        &lt;xsl:with-param name="result"&gt;
          &lt;xsl:value-of select="$result"&gt;&lt;/xsl:value-of&gt;
          &lt;xsl:value-of select="$string"&gt;&lt;/xsl:value-of&gt;
        &lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:value-of select="$result"&gt;&lt;/xsl:value-of&gt;
    &lt;/xsl:otherwise&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="dot.count.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="string.subst.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">dot.count </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> string.subst</td></tr></table></div></body></html>