Re: [xsl] counting element characters

Subject: Re: [xsl] counting element characters
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 11 Aug 2008 09:41:33 +0100
>   <xsl:variable name="c" as="text()*">
>           <xsl:for-each select="descendant::p">
>              <xsl:value-of  select="string-length(.)"/>

Just being pedantic, you'd probably want xs:integer* as the type there
instead of text()*, otherwise you'd be creating text nodes from the
integers returned from string-length(), and then when you sum() over
them they'd be converted from (probably) strings back into doubles...

As you you are just concerned with atomics and not nodes, use an
atomic type to prevent the unnecessary conversions.



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread