[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: case insensitive attributes

Subject: RE: case insensitive attributes
From: "Jay Gardner" <jgardner@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2001 13:27:45 -0500
msxml case insensitive attribute
Thanks Jeni 

That worked perfectly.

-----Original Message-----
From: Jeni Tennison [mailto:mail@xxxxxxxxxxxxxxxx]
Sent: Thursday, April 05, 2001 11:52 AM
To: Jay Gardner
Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  case insensitive attributes


Hi Jay,

Just to clarify - the translate() function takes its first argument as
a string, and changes all the letters in the string given as the
second argument for the corresponding letter in the string given as
the third argument.

> I ended up using this and it seems to be working, but
> I am not sure how efficient it will be.
>
> root/CamUsers[@UserId =
translate(@UserId,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
> 'abcdefghijklmnopqrstuvwxyz') = 'Admin']

That collects all the CamUsers elements where:

  the fact that the UserId attribute is equal to the lowercase version
  of the UserId attribute (i.e. either true() or false() - false() if
  the UserId has any uppercase letters in it)

  is equal to

  the result of converting the string 'Admin' to a boolean (which is
  always true() as 'Admin' is never an empty string)

So the fact that this is working implies that within your test data,
the CamUsers that you want to select are those whose UserId attributes
contain only lowercase letters.

That might be the case in your sample, but I don't think it was what
you were after.

If the 'Admin' string (i.e. the login name that you want to find the
CamUser for) can vary in case as well, then you need to do the
translation *on both*, so that they're both all lowercase. Using $uc
for uppercase letters and $lc for lowercase ones, this means you want:

   root/CamUsers[translate(@UserId, $uc, $lc) =
                 translate('Admin', $uc, $lc)]

If it's only the 'Admin' string that can change in case (i.e. the
@UserId attributes are always all lowercase), then you want to only
translate the 'Admin' string:

   root/CamUsers[@UserId, translate('Admin', $uc, $lc)]

If the @UserId attributes are always all in uppercase, then you want
to change the login name (e.g. 'Admin') into uppercase:

   root/CamUsers[@UserId, translate('Admin', $lc, $uc)]

I hope that's clearer,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.