Re: [xsl] case and strings conversion

Subject: Re: [xsl] case and strings conversion
From: JBryant@xxxxxxxxx
Date: Mon, 14 Feb 2005 11:43:13 -0600
As written, the translate function is working on the value of a variable: 
$string. So you would need a variable that gets the right string, as 
follows:

<xsl:variable name="string" select="jim/@name"/>

Also, you XML is malformed: It is missing a quotation mark before JaMeS 
and needs / before the closing > of the jim element.

I'm guessing (wildly) that what you really want to do is perform some 
action based on the value of a string, regardless of the case of the 
string. For that, you might find something like the following to be more 
useful:

<xsl:template match="jim[upper-case(@name)='JAMES']">
  <!-- Processing based on the match -->
</xsl:template>

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




dan sherman <h8_bsod@xxxxxxxxx> 
02/14/2005 11:27 AM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
[xsl] case and strings conversion






I am having trouble understanding strings and
converting of cases. If I want to match something
exaclty in the xsl the case must match exactly. I have
read the prevois posts on changing the case to match
but I am not getting it. How do I convert james to all
lower or all caps to test in xsl. I have the code and
below, but can not figure it out. Thanks.

<xsl:value-of select="translate($string,
'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>


<xml>
     <jim name=JaMeS">
</xml>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread