[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Function to convert string to upper case


Subject: Re: [xsl] Function to convert string to upper case
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 21 Sep 2006 10:30:07 +0530

With XSLT 1.0, you can do as following:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" />

   <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
   <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

   <xsl:template match="/">
      <xsl:value-of select="translate(doc, $smallcase, $uppercase)" />
   </xsl:template>

</xsl:stylesheet>

If you are using XSLT 2.0, then you can use XPath function "upper-case"
(http://www.w3.org/TR/xpath-functions/#func-upper-case)


On 9/21/06, Ambika.Das@xxxxxxxxxxxxxxxxxx <Ambika.Das@xxxxxxxxxxxxxxxxxx> wrote:
Hi,

Is there a way to convert a string to upper case? For example, given the
string testString, the output should be TESTSTRING.

Sample Input

<?xml version="1.0"?>
<doc>testString</doc>

Sample Output

TESTSTRING

Thanks & Regards,
Ambika Prasad Das


--
Regards,
Mukul Gandhi

http://gandhimukul.tripod.com


Current Thread
Keywords