<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.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="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> </td><th width="60%" align="center">General Library Templates</th><td width="20%" align="right"> <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 — Returns the number of <span class="quote">“<span class="quote">.</span>”</span> characters in a string </p></div> <div class="refsect1"><a name="idp9488416"></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"> <xsl:template name="dot.count"> <!-- Returns the number of "." characters in a string --> <xsl:param name="string"></xsl:param> <xsl:param name="count" select="0"></xsl:param> <xsl:choose> <xsl:when test="contains($string, '.')"> <xsl:call-template name="dot.count"> <xsl:with-param name="string" select="substring-after($string, '.')"></xsl:with-param> <xsl:with-param name="count" select="$count+1"></xsl:with-param> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$count"></xsl:value-of> </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="generallibrary.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="copy-string.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">General Library Templates </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> copy-string</td></tr></table></div></body></html>