4 users online. Create an account or sign in to join them.Users
Czech pluralizer
Description
Czech pluralizer - based on phoque's pluralizer, but adjusted for Czech language - supports different words for 0, 1, 2-4 and 5+ things.
XSLT
View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="sklonovani">
<xsl:param name="kolik" />
<xsl:param name="nula" />
<xsl:param name="jeden" />
<xsl:param name="dva" />
<xsl:param name="pet" />
<xsl:if test="$kolik = 0">
<xsl:value-of select="$nula" />
</xsl:if>
<xsl:if test="$kolik = 1">
<xsl:value-of select="$jeden" />
</xsl:if>
<xsl:if test="$kolik > 1 and $kolik < 5">
<xsl:value-of select="$kolik" />
<xsl:value-of select="$dva" />
</xsl:if>
<xsl:if test="$kolik > 4">
<xsl:value-of select="$kolik" />
<xsl:value-of select="$pet" />
</xsl:if>
</xsl:template>
<!--
Example usage: 1) add this:
<xsl:template name="sklonovani-komentare">
<xsl:param name="kolik" />
<xsl:call-template name="sklonovani">
<xsl:with-param name="kolik" select="$kolik" />
<xsl:with-param name="nula" select="'Bez komentaru'" />
<xsl:with-param name="jeden" select="'1 komentar'" />
<xsl:with-param name="dva" select="' komentare'" />
<xsl:with-param name="pet" select="' komentaru'" />
</xsl:call-template>
</xsl:template>
2) and then call it:
<xsl:call-template name="sklonovani-komentare">
<xsl:with-param name="kolik" select="/XPath/.../" />
</xsl:call-template>
-->
</xsl:stylesheet>