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

> 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 <>.

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)).


Jarno - O.T. Quartet: Hold That Sucker Down (Builds Like A Skyscraper Mix)

Current Thread