[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] string-length of all label attributes
Subject: RE: [xsl] string-length of all label attributes From: <Jarno.Elovirta@xxxxxxxxx> Date: Thu, 8 Jul 2004 12:58:35 +0300 |
Hi, > I am trying to calculate the string length of all @label attributes in > any element. > > When I apply string-length(//@label) in the root I only get the length > of the first attribute. But count(//@label) works fine. Because string-length expects a string argument and count a node-set. See the casting rules <http://www.w3.org/TR/xpath#function-string>. 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)). Cheers, Jarno - O.T. Quartet: Hold That Sucker Down (Builds Like A Skyscraper Mix)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] string-length of all labe, David Carlisle | Thread | Re: [xsl] string-length of all labe, George Cristian Bina |
Re: [xsl] test if node exists manda, David Carlisle | Date | Re: [xsl] commenting and documentin, David Carlisle |
Month |
Keywords