Re: [xsl] Testing for presence of alphabetical characters

Subject: Re: [xsl] Testing for presence of alphabetical characters
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 06 Feb 2006 16:11:07 -0500
At 01:38 PM 2/6/2006, Andrew wrote:
> Ah -- testing for presence of alphabetical characters -- in XPath 1.0,
>
> not(string-length($cont) = string-length(translate($cont,$alpha,''))

or

contains(translate($cont, $alpha, 'x'), 'x')

I've heard that string-length() can get expensive because of
multi-byte characters, although I would've thought translate()
sufferered from the same problem...

It might, although it's never slowed down any of my stylesheets so as to notice. :->


In any case, translate() is fun -- the secret-decoder-ring function, with all kind of nifty uses.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread