xsltxslt-2.0

XSLT using count to add s to the string


Is there a better way to do this I am adding the s if the count is not 1 and if it has the 1 I dont add that line.

 <xsl:choose>
    <xsl:when test=".//Count = 1">
      <li>Changes to the <i>Reference</i> section have been made to the following template: </li>
    </xsl:when>
    <xsl:otherwise>
      <li>Changes to the <i>Reference</i> section have been made to the following templates:</li>
    </xsl:otherwise>
</xsl:choose>

Solution

  • Instead of duplicating so much of the content, I'd do something like this:

    <li>Changes to the <i>Reference</i> section have been made to the following template<xsl:value-of select="if(.//Count = 1) then '' else 's'"/>: </li>