Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > 6e019a662639ac6470f50dea3a4d8157 > files > 938

docbook-style-xsl-doc-1.79.2-4.mga7.noarch.rpm

<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>dot.count</title><link rel="stylesheet" type="text/css" href="../reference.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.2"><link rel="home" href="../index.html" title="DocBook XSL Stylesheets: Reference&nbsp;Documentation"><link rel="up" href="generallibrary.html" title="General Library Templates"><link rel="prev" href="generallibrary.html" title="General Library Templates"><link rel="next" href="copy-string.html" title="copy-string"><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">dot.count</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="generallibrary.html">Prev</a>&nbsp;</td><th width="60%" align="center">General Library Templates</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="copy-string.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="dot.count"></a><div class="titlepage"></div><div class="refnamediv"><h2>dot.count</h2><p>dot.count &#8212; Returns the number of <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> characters in a string</p></div><div class="refsect1"><a name="d0e33169"></a><h2>Description</h2><p>Given a string, the <code class="function">dot.count</code>
    template returns the number of dot/period characters in the
    string. This template is useful, for example, when testing the
    nesting level of nested inline markup (for nested emphasis,
    quotations, etc.).</p><a name="dot.count.frag"></a><pre class="programlisting">
&lt;xsl:template name="dot.count"&gt;
  &lt;!-- Returns the number of "." characters in a 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:choose&gt;
    &lt;xsl:when test="contains($string, '.')"&gt;
      &lt;xsl:call-template name="dot.count"&gt;
        &lt;xsl:with-param name="string" select="substring-after($string, '.')"&gt;&lt;/xsl:with-param&gt;
        &lt;xsl:with-param name="count" select="$count+1"&gt;&lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:value-of select="$count"&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="generallibrary.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="generallibrary.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="copy-string.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">General Library Templates&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;copy-string</td></tr></table></div></body></html>