Subject: Re: format the date From: Matt Sergeant <matt@xxxxxxxxxxxx> Date: Fri, 23 Jun 2000 11:31:48 +0100 (BST) |
On Fri, 23 Jun 2000, Richard Light wrote: > In message <200006240843.KAA03336@xxxxxxxxxxxxxxxxx>, SAUREL Eric > <Eric.SAUREL@xxxxxxxxxxx> writes > >hi, > >i have : <date format="ISO-8601">2000-05-24</date> > >how can i have the date on this format : Vendredi 24 juin 2000 > >[ i am french ]. > >where i can find some informations about this. > >thank for your help. > > This code (not tested, although it's based on a routine which has been) > should output "24 mai 2000" [sic] for the date you specify. I haven't a > clue how to derive the day of the week in XSLT! > > <xsl:template name="convertMonth"> > <xsl:variable name="month-as-number" select="number(substring- > before(substring-after(text(), '-'), '-'))"/> > <xsl:choose> > <xsl:when test="$month-as-number=1">janvier</xsl:when> > <xsl:when test="$month-as-number=2">février</xsl:when> > <xsl:when test="$month-as-number=3">mars</xsl:when> > <xsl:when test="$month-as-number=4">avril</xsl:when> > <xsl:when test="$month-as-number=5">mai</xsl:when> > <xsl:when test="$month-as-number=6">juin</xsl:when> > <xsl:when test="$month-as-number=7">juillet</xsl:when> > <xsl:when test="$month-as-number=8">août</xsl:when> > <xsl:when test="$month-as-number=9">septembre</xsl:when> > <xsl:when test="$month-as-number=10">octobre</xsl:when> > <xsl:when test="$month-as-number=11">novembre</xsl:when> > <xsl:when test="$month-as-number=12">decembre</xsl:when> > <xsl:otherwise><xsl:value-of select="concat('[invalid month: ', > '$month-as-number')"/></xsl:otherwise> > </xsl:choose> > </xsl:template> > > <xsl:template xml:space="preserve" match="date[@format='ISO-8601']"> > <xsl:value-of select="substring-after(substring-after(text(), '-'), > '-')"/> > <xsl:call-template name="convertMonth"/> > <xsl:value-of select="substring-before(text(), '-')"/> > </xsl:template> Oh ouch ouch ouch... Why oh why are people not climbing the walls with XSLT! -- <Matt/> Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: format the date, Richard Light | Thread | RE: format the date, Kay Michael |
RE: a special char question, Selim Cesic | Date | Re: XLS files scrambling, Matt Sergeant |
Month |