This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: counting the number of tokens in a string?
- From: "Marrow" <marrow at marrowsoft dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 2 Oct 2002 17:52:43 +0100
- Subject: RE: [xsl] counting the number of tokens in a string?
- Organization: MarrowSoft Ltd.
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
You could use something like...
<xsl:value-of select="string-length(ITEM/@cols) -
string-length(translate(ITEM/@cols,',','')) +
1"/>
Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of john liao
Sent: 02 October 2002 17:36
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] counting the number of tokens in a string?
Hi,
another newbie question. Is there an easy way to count
the number of commas in a string? Like this:
<ITEM cols="col1,col2,col3,col4"/>
I would like to print 4 for the number of columns in
my ITEM. I searched on tokenize() but most of the
references are about the existence of it.
Thanks,
J.L.
=====
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list