Re: [xsl] string-length of all label attributes

Subject: Re: [xsl] string-length of all label attributes
From: George Cristian Bina <george@xxxxxxx>
Date: Thu, 08 Jul 2004 13:10:15 +0300
> You need to write a recursive template that goes throught the nodes in the node-set and sums the string-lengths, or if you're using XPath 2.0, then something in the lines of sum(for $i in //@label return string-length($i)).

Or you can get all the labels inside a variable and get the length of that variable:

    <xsl:template match="/">
        <xsl:variable name="labels">
            <xsl:for-each select="//@label">
                <xsl:value-of select="."/>
        <xsl:value-of select="string-length($labels)"/>

Hope that helps,
George Cristian Bina
<oXygen/> XML Editor & XSLT Editor/Debugger

Current Thread