Я знаю, что это старый вопрос, но, поскольку я нашел его, когда искал встроенное решение для XPath 1.0, возможно, мое предложение может быть полезным для кого-то другого, также ищущего решение для максимальной длины.
Если в таблице стилей XSLT требуется значение максимальной длины, его можно найти с помощью шаблона:
<!-- global variable for cases when target nodes in different parents. -->
<xsl:variable name="ellist" select="/root/element" />
<!-- global variable to avoid repeating the count for each iteration. -->
<xsl:variable name="elstop" select="count($ellist)+1" />
<xsl:template name="get_max_element">
<xsl:param name="index" select="1" />
<xsl:param name="max" select="0" />
<xsl:choose>
<xsl:when test="$index < $elstop">
<xsl:variable name="clen" select="string-length(.)" />
<xsl:call-template name="get_max_element">
<xsl:with-param name="index" select="($index)+1" />
<xsl:with-param name="max">
<xsl:choose>
<xsl:when test="$clen > &max">
<xsl:value-of select="$clen" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$max" />
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$max" /></xsl:otherwise>
</xsl:choose>
</xsl:template>
`