[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: string-length of all label attributes
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 [expletive deleted] Down (Builds Like A Skyscraper Mix)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|