[xslt1.0] Count the number of character

Here should go questions about transforming XML with XSLT and FOP.
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

[xslt1.0] Count the number of character

Post by Le Basque »

Hi,
I would like to count the number of # in a string
example :

Code: Select all


<xx>1#2#3#4#</xx>
number of # = 4

exists a function to count character in string ?

Thank you
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Re: [xslt1.0] Count the number of character

Post by Le Basque »

i found a solution

Code: Select all


<xsl:variable name="nb_char" select="string-length(xx)-string-length(translate(xx,'#',''))"/>
Post Reply