xsl-list
[Top] [All Lists]

Re: case and strings conversion

2005-02-14 10:43:13
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(_at_)yahoo(_dot_)com> 
02/14/2005 11:27 AM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>