Convert UPPERCASE string to Upper-Lower Case (ie. THIS IS MY STRING -> This Is My String)

I recently had the need to convert an all capitalized string to upper/lower case, but couldn't find anything to do it in XSLT 1.0.  If it helps anyone out, I wrote the following: 

 Call it using:

<xsl:template match="Ads">
  <xsl:call-template name="ToUpperLowerCase">
   <xsl:with-param name="inputString" select="YOURSTRINGHERE"/>
   <xsl:with-param name="index" select="0"/>
   <xsl:with-param name="loopCount" select="string-length(YOURSTRINGHERE)+1"/>
  </xsl:call-template>
 </xsl:template>

 Code to Perform Upper / Lower Case
 
 <xsl:template name="ToUpperLowerCase">
  <xsl:param name="inputString"/>
  <xsl:param name="index"/>
  <xsl:param name="loopCount"/>
  <xsl:if test="$index &lt; $loopCount">
   <xsl:choose>
    <xsl:when test="substring($inputString, ($index)-1,1) = ' ' or $index = 1">
     <xsl:call-template name="ToUpper">
      <xsl:with-param name="inputString" select="substring($inputString,$index,1)"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:call-template name="ToLower">
      <xsl:with-param name="inputString" select="substring($inputString,$index,1)"/>
     </xsl:call-template>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:call-template name="ToUpperLowerCase">
    <xsl:with-param name="inputString" select="$inputString"/>
    <xsl:with-param name="index" select="($index)+1"/>
    <xsl:with-param name="loopCount" select="$loopCount"/>
   </xsl:call-template>
  </xsl:if>
 </xsl:template>
 
 <xsl:template name="ToLower">
  <xsl:param name="inputString"/>
  <xsl:variable name="smallCase" select="'abcdefghijklmnopqrstuvwxyz'"/>
  <xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:value-of select="translate($inputString,$upperCase, $smallCase)"/>
 </xsl:template>
 
 <xsl:template name="ToUpper">
  <xsl:param name="inputString"/>
  <xsl:variable name="smallCase" select="'abcdefghijklmnopqrstuvwxyz'"/>
  <xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:value-of select="translate($inputString,$smallCase,$upperCase)"/>
 </xsl:template>


-dp
0
dperkalis
10/31/2008 7:31:17 PM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

0 Replies
1283 Views

Similar Articles

[PageSpeed] 40

Reply:

Similar Artilces:

String and string?
Hi guys, I was wondering the difference between small letter string type and a capital letter String type. Does anyone know about this? Highly appreciate for your answers! Thankz! The "proper" version is String, as it references the System.String class of the .NET Framework Class Library. The ability to use string is provided by C#, where it is an alias to String. Similarly, the "proper" version of an integer is Int32, as it references System.Int32.  The ability to use int is provided by C#, and the ability to use Integer is provided by VB.NET, and both int and Integer are aliases...

string() = string()
this code does not work (not instance of object) Dim Items(), Other() As String Items = New String() {"A","B","C"} Other = New String() {} Other = Items how can I get all the values ? angiras Hi, If I understand your requirement correctly, this should do it Dim Items() As String = {"A", "B", "C"} Dim Other(Items.Length - 1) As String Items.CopyTo(Other, 0) To more closely match you code above, but this will be less efficient Dim Items(), Other() As String ...

String and String[]
What will be the advantage of using myString: String[10] over myString: String Man wrote: > What will be the advantage of using > myString: String[10] > over > myString: String "String[10]" is a fixed-length, statically allocated, Ansi-based ShortString. "String" is a dynamic-length, dynamically allocated, reference counted, Ansi-based or Unicode-based (depening on Delphi version) Long string. Unless you absolutely need the static, fixed length nature of ShortString, such as in records that interact with external systems, you should stay ...

string to string[]
Hi, I've got this code : string[] Params; string SQL = "SELECT * FROM T_MANAGEMENT_PAGES"; SqlCommand myCommand = new SqlCommand(SQL, myConnection); myConnection.Open(); SqlDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { Params_Type = myReader.GetValue(0).ToString(); } } catch { } finally { } myReader.Close(); My problem is to obtain Params_Type. But each time, it says : "impossible to convert '[object]' in 'string[]' &quo...

string and string[]
hello, whats the difference here between string and string[] thanks "string" denotes an item of type String "string[]" denotes an array of type String itemsThanks, EdMicrosoft MVP - ASP/ASP.NET Gracia mon ami...

a string in a string in a string in my code behind....
I know my title talk about code-behind, but this is really a client-side problem (and surely a newby one too, sorry about that).I have a javascript function that my make a little text appear when the onmouseover event of a link is activated.So, normally, if my link was inside my html code, it would be something like this:<a href = "whocare.com"  onmouseover="poplink('I want to test something');">test</a>BUT, for some reason, I have to write this part in code behind with the LiteralControl function....and that will give something like that:this.Controls.Add(new LiteralCo...

m_AVP As IDictionary(Of String, String) = New Dictionary(Of String, String) ,not defined?
   I am creating a usercontrol (ascx,ascx.vb)   I have used Imports system.Collections Imports system.Collections.Generic     Private m_AttributeValuePair As IDictionary(Of String, String) = New Dictionary(Of String, String)     But I am gettting an error “Type Dictionary is not defined”   And also I am getting intelisense to type the line But what is the reason for my error ? How can I get escape from the error ?         this error is not showing today  ...

String DataKeyNames for string[] datasource
 Hi, I am having a problem with a gridview.  I am binding an array of strings to the gridview and then having a problem setting the DataKeyNames.  Because the dataItem is of type string I cant place the name of any property in DataKeyNames property. gridView.DataSource = new string[] { "one", "two" };gridView.DataBind(); <asp:GridView runat="server" ID="gridView" DataKeyNames="???"> <Columns> ... </Columns> </asp:GridView> The only solution I can thing of is to convert the string array into an ar...

convert octet string to string
I'm trying to use IDM 3.5.1 provision an AD environmnet with users from eDir. We wanna provision as much info as possible, but one attribute gives us headaches. This is an auxiliary attribute associated with each user in eDir that has it's syntax set to octet string. Problem is we need to provision this over to another attribute in AD that uses string as its syntax. Is thee a way through XPath or ECMA script to have the value converted during the provisioning? I've no experience with either XPath or ECMA so please be detailed in your replies. Thx -- jdoeconsu...

Converting a list of string into string
When I try the following code in Prism I get the error "Error 8 (CE15) Type mismatch, cannot assign array of System.String to System.String " ***************************************************************** var mobileNumberList :List<string> mobNumberArray :string Begin mobileNumberList.add('1234567890'); mobNumberArray := mobileNumberList.ToArray();//error here end; *************************************************************** What needs to be done to convert an array of strings to a string Venkatesh Venkatesh VT a écrit : > When I...

Convert string to string array.
Hi, We have a string array argument in datawindow object for 'IN' sql statement. Our user enter a string in a single line edit. How to convert the string to a string array for the argument of datawindow? ex. user input : 'A', 'B', 'C' => str_arr[]={'A', 'B', 'C'} dw_1.retrieve(str_arr) Thanks in advance. Take a look at the n_cst_string object in the pfc. It has a method called of_ParseToArray that does exactly what you're looking for. It's a pretty simple task to 'port' the code ...

How to convert a String into a UTF8 String
Hello! I want to convert a normal String into a UTF8 String for example:myString = BüromyUTF8String = Büros  I dont know how to do this. In PHP you can do this with myUTF8String = utf8_encode(myString) Thank you for all hints! try this string test ="ÁÉÍÓÚ áéíóú àèìòù äëïöü Ññ €"; byte[] a= System.Text.Encoding.UTF8.GetBytes(test); string test2= System.Text.Encoding.UTF8.GetString(a);  greetingsBest Regards,Sebastián DopicoBlog Desarrollador Thank you Sebastián! If I make it like that - test2 looks the same as test.But I think my problem is solved. (Someone tol...

string to string[] #2
string[] strArray;while(dtardrUsrDet.Read())   {string strUsrEmail=dtardrUsrDet.GetValue(0).ToString(); int intDayDiff=System.Convert.ToInt16(dtardrUsrDet.GetValue(1).ToString());if(intDayDiff==45) {   strArray=strUsrEmail; }if(intDayDiff==30) {   strArray=strUsrEmail; }     how to store string values from reader into string arrayMark As Answer If my reply helped you. Hi, I am assuming that you want each string in an array, not each character as a separate string in a string array here.... The easiest way is to create an ArrayList, add each stri...

Why String.Split(char[]) is possible but String.Split(string[]) is Not!
Hi everyone, i have a string for e:g String st= "Delete a record****** *************************************************** Delete Manually PatID=123456 PatName=navdeep *****Delete a record****** *************************************************** Delete Manually *****************PatID=123 PatName=navdeep6666" I need to Split this String by "Delete a record" string. Now, str[] will contain the array elements. str = st.Split("Delete a record"); Please Help Regards Navdeep check below link or try code  http://www.codeproject.co...

How to Encrypt a String to a String?
Hi Folks,I’m using Triple DES to encrypt a string… the output of the encryption is a byte array.However, I want to store the encrypted result as a string in a SQL Database and not as a byte array.(The reason I want to store it as a string, is to be able to copy & paste the result to a standalone windows form application  to decrypt it...) I’ve tried taking the byte array, converting it into a string…And then reconverting it into a byte array for the decryption. This causes an error upon decryption…How can I convert the encrypted byte array into a string and back into a byt...

Web resources about - Convert UPPERCASE string to Upper-Lower Case (ie. THIS IS MY STRING -> This Is My String) - asp.net.xml-datasource

Upper and lower bounds - Wikipedia, the free encyclopedia
A subset S of a partially ordered set P may fail to have any bounds or may have many different upper and lower bounds. By transitivity , any ...

NSW State Election 2015: Upper and Lower house results
Pendulum graphics showing the NSW state election results in the lower and upper houses.

NSW State Election 2015: Upper and Lower house results
Pendulum graphics showing the NSW state election results in the lower and upper houses.

NSW State Election 2015: Upper and Lower house results
Pendulum graphics showing the NSW state election results in the lower and upper houses.

NSW State Election 2015: Upper and Lower house results
Pendulum graphics showing the NSW state election results in the lower and upper houses.

NSW State Election 2015: Upper and Lower house results
Pendulum graphics showing the NSW state election results in the lower and upper houses.

Where are the most important MPG increases, at the upper or lower end?
Imagine, if you will, taking a sheet of paper and cutting it in half. Now take one of those halves and cut it in half again. Now keep repeating ...

The Uncluttered Carbine: A Personalized Upper/Lower Matchup Results In A Purpose-Built, Accurate AR
The Uncluttered Carbine: A Personalized Upper/Lower Matchup Results In A Purpose-Built, Accurate AR

Another Fan Dies At A Football Game, This Time After Falling From Upper Level To Lower Level While Celebrating ...
... of Lenoir City, Tennessee, died on Friday night after falling over a 33-inch balcony railing in the Georgia Dome and dropping to the lower level. ...

How to tell if the shift key is lower case, Upper Case, or CAPS LOCK in iOS 7.1
... 7.1 is how the state of the shift key is displayed. Not only isn't it intuitively obvious which state the shift key is in — lowercase, Upper ...

Resources last updated: 12/8/2015 3:37:08 AM