Subject: RE: Count Words
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 8 Aug 2004 23:11:28 +0100
|
You could use the exslt:tokenize extension function with XSLT 1.0, or the
built-in tokenize() function with XSLT 2.0.
Alternatively:
<xsl:variable name="in" select="normalize-space(hey_diddle)"/>
<xsl:value-of select="string-length(translate($in, translate($in, ' ', '')))
+ 1"/>
Michael Kay
> -----Original Message-----
> From: Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxxxxxxxxx]
> Sent: 08 August 2004 21:19
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Count Words
>
> Hello,
>
> Given the following:
>
> =========== xml source ==========
> <poem>
> <hey_diddle>
> Hey diddle diddle, the cat and the fiddle,
> The cow jumped over the moon,
> The little dog laughed to see such sport,
> And the dish ran away with the spoon.
> </hey_diddle>
> </poem>
> =========== /xml source ==========
>
> How do I count how many words are contained within the node
> <hey_diddle/>?
>
> Karl
|