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

Subject: RE: [xsl] string-length of all label attributes
From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx>
Date: Thu, 8 Jul 2004 12:11:44 +0200
Thanks a lot. That will work perfectly.

Cheers R.

-----Original Message-----
From: George Cristian Bina [mailto:george@xxxxxxx]
Sent: Thursday, July 08, 2004 12:10 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] string-length of all label attributes


 > 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