Subject: Re: [xsl] Date problem From: Mike Brown <mike@xxxxxxxx> Date: Mon, 9 Dec 2002 09:56:33 -0700 (MST) |
Hélder Sousa wrote: > <xsl:element name="input"> > <xsl:attribute name="type">hidden</xsl:attribute> > <xsl:attribute name="name">todayDate</xsl:attribute> > <xsl:attribute name="value">????????</xsl:attribute> > </xsl:element> > The question is: how I put the actual date in "????????"? 100% portable way: Put <xsl:param name="dateval"/> at the top of your stylesheet (just before the first template) and pass $dateval as an external parameter when you invoke the XSLT processor. (see your XSLT processor's API documentation for how to do this) > Is there any function in xsl that returns the actual date? If your XSLT processor implements the EXSLT extension functions, yes. See http://exslt.org/date/index.html, particularly date:date-time(). Note that there is even an implementation for MSXML (though you have to embed it in your stylesheet). <!-- xsl:import must be the first thing after xsl:stylesheet. You need to get date.msxsl.xsl from http://exslt.org/date/functions/date-time/date.msxsl.xsl --> <xsl:import href="date.msxsl.xsl"/> <xsl:param name="dateval"/> ... <xsl:template ...> ... <input type="hidden" name="todayDate"> <xsl:attribute name="value"> <xsl:choose> <xsl:when test="function-available('date:date-time')" xmlns:date="http://exslt.org/dates-and-times"> <xsl:value-of select="date:date-time()"/> </xsl:when> <xsl:when test="$dateval"> <xsl:value-of select="$dateval"/> </xsl:when> <xsl:otherwise>unknown</xsl:otherwise> </xsl:choose> </xsl:attribute> </input> ... </xsl:template> Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Date problem, Mike Brown | Thread | RE: [xsl] Date problem, Michael Kay |
[xsl] ANNOUNCING XSLT Web Services , Gunther Schadow | Date | Antwort: [xsl] Date problem, manfred . weigel |
Month |