Subject: Re: counting element characters
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 11 Aug 2008 07:45:02 -0700
|
> Which can be spelled as following, in order to prevent creating
> useless text nodes:
Sure Florent,
We both know better ways to write this.
In order to help people I am trying to concentrate on their *main*
problem (one at a time) so that they get the main message.
Teaching them how to write good XSLT is probably not too-realistic in
the context of an isolated thread and would never replace a more
systematic approach, based on reading "the books".
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
On Mon, Aug 11, 2008 at 12:42 AM, Florent Georges <lists@xxxxxxxxxxxx> wrote:
> Dimitre Novatchev wrote:
>
> Hi
>
>> <xsl:template match="a">
>> <xsl:variable name="c" as="text()*">
>> <xsl:for-each select="descendant::p">
>> <xsl:value-of select="string-length(.)"/>
>> </xsl:for-each>
>> </xsl:variable>
>> <xsl:value-of select="sum($c)"/>
>> </xsl:template>
>
> Which can be spelled as following, in order to prevent creating
> useless text nodes:
>
> <xsl:template match="a">
> <xsl:value-of select="sum(.//p/string-length(.))"/>
> </xsl:template>
>
> Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _____________________________________________________________________________
> Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr
|