Subject: Re: [xsl] Testing for presence of alphabetical characters From: Jon Gorman <jonathan.gorman@xxxxxxxxx> Date: Mon, 6 Feb 2006 12:15:12 -0600 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Testing for presence of alpha, Ian MacDaniel | Thread | Re: [xsl] Testing for presence of a, Wendell Piez |
[xsl] Testing for presence of alpha, Ian MacDaniel | Date | Re: [xsl] Testing for presence of a, Wendell Piez |
Month |