|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing for presence of 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






