This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

String manipulation question


Hi Everyone, 
My question is regarding some string manipulation.
I have template which looks at a string value of a date 
(eg 02-03-02 param1) and a dateformat (eg. DD-MM-YY param2).

My template has to (for e.g.): 
return       02-03-02
if  param1=  2-3-02
and param2=  DD-MM-YY

or 
return       02/03/2002
if  param1=  02/3/02
and param2=  DD-MM-YYYY    


I'm having difficulties in thinking of a short and neat way of appending '0'
in front of any number between 1-9 (if its not already there). 
[And appending a '20' for a year format (if its not already there)].
Any help appreciated.

Template
--------
<xsl:template name="dateFormat">
  <xsl:param name="str">
  <xsl:param name="date-format">
  <xsl:variable  name="str2">
    <xsl:choose>
      <xsl:when test="string-length($str) = string-length($date-format)">
	   <xsl:value-of select="$str"/>
      </xsl:when>
      <xsl:otherwise>
        
		<!-- need some help here -->

	</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
</xsl:template>

Regards
Bodrul




 


 ---------------------------------------------------------------------------

The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged
material.
Any views or opinions presented in this Email message are solely those 
of the author and do not necessarily represent those of Synergy 
Logistics Limited  unless specifically stated. 
Email communications are not necessarily secure and therefore 
Synergy Logistics Limited does not accept legal responsibility for the 
contents of this message. 
If you are not the intended recipient and have received this message in 
error, Please notify Synergy Logistics Limited immediately. 

         Synergy Logistics Ltd. 01509 232706

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]