xsl-list
[Top] [All Lists]

RE: string-length of all label attributes

2004-07-08 03:11:44
Thanks a lot. That will work perfectly.

Cheers R.

-----Original Message-----
From: George Cristian Bina [mailto:george(_at_)sync(_dot_)ro] 
Sent: Thursday, July 08, 2004 12:10 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



<Prev in Thread] Current Thread [Next in Thread>