|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XPath Assistance
[ 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
|
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
|

Cart








