This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: case insensitive attributes


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
this:

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

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

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@medicalcontracting.com]
Sent: Thursday, April 05, 2001 12:09 PM
To: Jeni Tennison
Cc: xsl-list@lists.mulberrytech.com
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']

Regards,

Jay Gardner

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]