Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Capitalize first letter of month by using xslt
4183 Views
Introduction 
When month taken by using ddwrt namespace it gives the name first letter in captial for some languages only.
For example December in english but dicembre in italian.So here i tried some xslt code to change the first letter in captial.
Example
	 <xsl:variable name="caseLower" select= "'abcdefghijklmnopqrstuvwxyz'"/>
	<xsl:variable name="caseUpper" select= "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
	<xsl:variable name="testNewsdate"> <!--It gives Month name as décembre in french-->
	<xsl:value-of select="ddwrt:FormatDateTime(string(@CreatedDate),1036,'MMMM yyyy: ')" />
	</xsl:variable>
	<xsl:variable name="dateNews"> <!--It translate Month name as Décembre in french-->
	<xsl:value-of select= "concat(translate(substring($testNewsdate,1,1), $caseLower, $caseUpper),
	substring($testNewsdate, 2),substring(' ', 1 div not(position()=last())) )  "/>
	</xsl:variable>
Output 
Before translating - décembre 2013
After translating - Décembre 2013
Best Lessons of "Sharepoint(MOSS) XSLT codes"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details