Subject: Re: [xsl] Actual Date From: Stephane Bortzmeyer <bortzmeyer@xxxxxx> Date: Fri, 30 May 2003 11:15:48 +0000 |
On Wed, May 28, 2003 at 01:58:39PM +0200, Molnár Ágnes <agi@xxxxxxxxxxxxxxxxx> wrote a message of 205 lines which said: > Can I insert to a HTML code the actual date (ex. 28-05-2003) from > XSL? Combining replies you already received (params , portable but inconvenient, and exslt, the best way but not portable), here is what I do: <xsl:param name="current_date">(UNSPECIFIED)</xsl:param> <xsl:template match="/"> ... <xsl:choose> <xsl:when test="function-available('date:date-time')"> <!-- EXSLT available --> <xsl:variable name="now" select="date:date-time()"/> <xsl:value-of select="date:year($now)"/> <xsl:text>/</xsl:text> <xsl:value-of select="date:month-in-year($now)"/> <xsl:text>/</xsl:text> <xsl:value-of select="date:day-in-month($now)"/> <xsl:text> (date obtained by the XSL processor)</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="$current_date"/> <xsl:text> (date obtained from the calling program)</xsl:text> </xsl:otherwise> </xsl:choose> ... Passing the param depends on the XSLT processor. Here is a part of a Makefile for xsltproc: xsltproc -o $@ \ --stringparam current_date "`date +%Y/%m/%d`" \ ... ${STYLESHEET} $< And for Sablotron : sabcmd ${STYLESHEET} $< $@ "\$$current_date=`date +%Y/%m/%d`" XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Actual Date, Alan Gardner | Thread | RE: [xsl] Actual Date, Jarno . Elovirta |
[xsl] adding link to report, Sawyer, Larry | Date | [xsl] problem with number, abbouh |
Month |