| Subject: RE: [xsl] XPath Assistance From: "Passin, Tom" <tpassin@xxxxxxxxxxxx> Date: Fri, 28 Mar 2003 17:20:53 -0500 | 
[ Scott Purcell]
> Also, in the above example: child::first='John'
> How could I find John if the name was lower case john?
> Eg: I would like to find John or john or JOHN or JOhn.
> 
Names in XML, as you probably know, are case-sensitive, and xslt does
not have a case-insensitive compare.  The usual way to do a
case-insensitive compare is to use the the translate() function.  Here
as an example, where I create separate variables.  You do not have to do
this but it is more readable, and easier if you will be doing several
such compares.
<xsl:variable name='uppers'
   select='"ABCDEFGHIJKLMNOPQRSTUVWXYZ"'/>
<xsl:variable name='lowers'
   select='"abcdefghijklmnopqrstuvwxyz"'/>
The test in your predicate could be something like this ("first" is the
shorthand syntax for "child::first") -
translate(first, $uppers, $lowers) = "john"
Notice that you need quotes around the two translation strings,
otherwise they would be understood as element names rather than as
strings.
Cheers,
Tom P
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] XPath Assistance, Randy Oxentenko | Thread | [xsl] node concatenation, bix xslt | 
| RE: [xsl] XPath Assistance, Randy Oxentenko | Date | [xsl] simple matching problem, Mac Martine | 
| Month |