RE: [xsl] case insensitive attributes

Subject: RE: [xsl] case insensitive attributes
From: James Eberhardt <JEberhardt@xxxxxxxxxx>
Date: Thu, 5 Apr 2001 12:24:51 -0400
Since you should want to control your data, then what I would suggest is
translating your user input before putting in the XML.  That way UserId is
ALWAYS the same case.  Just my thought.  Otherwise I don't think you can
test for this in one XPath statement.  What you might try is do an
apply-templates, then within that template test the value of UserId.  Like

<xsl:template match="/">
	<xsl:apply-templates select="//CamUsers" />

<xsl:template match="//CamUsers">
	<xsl:if test="translate(@UserId,'admin','ADMIN')='ADMIN'">
		<xsl:value-of select="." />

The solution that Jeni was suggesting would check only if UserId was one or
the other.  (I think)

-----Original Message-----
From: Jay Gardner [mailto:jgardner@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Thursday, April 05, 2001 12:09 PM
To: Jeni Tennison
Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] case insensitive attributes

Thanks Jeni

Actually, the all caps ADMIN was just for testing.

It could come in as Admin ADmin ADmiN or anything 
like that.  It comes from user input to a login form.

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']


Jay Gardner

 XSL-List info and archive:

Current Thread