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:for-each>
        </xsl:variable>
        <xsl:value-of select="string-length($labels)"/>
    </xsl:template>

Hope that helps,
George
-----------------------------------------------
George Cristian Bina
<oXygen/> XML Editor & XSLT Editor/Debugger
http://www.oxygenxml.com

Current Thread