[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Testing for presence of alphabetical characters

Subject: Re: Testing for presence of alphabetical characters
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Mon, 6 Feb 2006 12:15:12 -0600
alphabetical characters
On 2/6/06, Ian MacDaniel <ian_macdaniel@xxxxxxxxx> wrote:
> Using Saxon 851... can someone tell me why the
> following expression returns false?
[snip]
> <xsl:variable name="alpha"
> select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
> <xsl:if test="contains($alpha, $cont)">
[/snip]


Errr, I think you are misunderstanding contains (possibly because of
how translate works).  If you read the function description for XPath
2.0 (or XPath 1.0, I don't think it has changed at all) it says the
function contains tests to see if the first string contains the second
string anywhere.  Unless $cont is always a single character or
contains a string in alphabetical order (like bc or CD), it's highly
unlikely it will match.  1a will give a false, since the first string
does not contain the string 1a anywhere.  Are you looking for a
function that will always return true if any character is a alpha
character ?

See http://www.w3.org/TR/xquery-operators/ for a description of XPath
2 functions and http://www.w3.org/TR/xpath for the description of
XPath 1 functions.

Jon Gorman

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.