xsl-list
[Top] [All Lists]

Re: [xsl] counting element characters

2008-08-11 01:42:00
  <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/

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