Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 27th, 2009, 06:12 PM
Authorized User
 
Join Date: Oct 2006
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get attribute by ignoring the cases (case-insensitive)

Hi. I'm using XSLT 1.0.

I have the following 3 inputs:
<Ball color='yellow'>big</Ball>
<Ball Color='Green'>Small</Ball>
<Ball COLOR='RED'>MEDIUM</Ball>

How do I get the value of 'color' attribute by ignoring the cases (lower, mix, upper)?

This is what I have so far:
<xsl:template match="Ball">
<xsl:value-of select='normalize-space(@color)'/>
</xsl:template>
 
Old January 27th, 2009, 06:36 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You really need XSLT 2.0 to do this properly, but so long as your text is ascii-only, you can normalize case using translate(., 'ABCDEFGH...Z', 'abcdefgh...z')
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Case Insensitive Comparison in Oracle 9i ashu_from_india Oracle 0 December 29th, 2005 02:53 AM
test cases for data submission simplyAns MySQL 2 November 2nd, 2005 10:21 AM
XPath Case Insensitive safin XML 3 October 17th, 2005 12:32 PM
ADO Filter: Case Insensitive moshepack All Other Wrox Books 0 April 29th, 2004 08:51 AM
Check Case in a Case-Insensitive DB nbryson SQL Language 1 January 23rd, 2004 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.