<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>count.uri.path.depth</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="relativeuri.html" title="Relative URI Functions"><link rel="prev" href="relativeuri.html" title="Relative URI Functions"><link rel="next" href="trim.common.uri.paths.html" title="trim.common.uri.paths"><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">count.uri.path.depth</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="relativeuri.html">Prev</a> </td><th width="60%" align="center">Relative URI Functions</th><td width="20%" align="right"> <a accesskey="n" href="trim.common.uri.paths.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="count.uri.path.depth"></a><div class="titlepage"></div> <div class="refnamediv"><h2>count.uri.path.depth</h2><p> count.uri.path.depth — Count the number of path components in a relative URI </p></div> <div class="refsect1"><a name="idp9622288"></a><h2>Description</h2> <p>This function counts the number of path components in a relative URI.</p> <a name="count.uri.path.depth.frag"></a><pre class="programlisting"> <xsl:template name="count.uri.path.depth"> <xsl:param name="filename" select="''"></xsl:param> <xsl:param name="count" select="0"></xsl:param> <xsl:choose> <xsl:when test="contains($filename, '/')"> <xsl:call-template name="count.uri.path.depth"> <xsl:with-param name="filename" select="substring-after($filename, '/')"></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="relativeuri.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="relativeuri.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="trim.common.uri.paths.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Relative URI Functions </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> trim.common.uri.paths</td></tr></table></div></body></html>