Subject: Re: [xsl] Retrieving the date of processing From: Daniel Bibbens <dbibbens@xxxxxxxxxx> Date: Fri, 20 Aug 2004 20:14:14 -0500 |
David.Pawson@xxxxxxxxxxx writes: > Not thinking. If you are using xslt 2.0 you already > have access to the date and time. Sorry. > > Xslt 1.0 > > <h1>On the third stroke it will be <xsl:value-of > select="document('http://xobjex.com/cgi-bin/date.pl')"/></h1> > gives: > > On the third stroke it will be Thu Aug 19 00:14:27 20042004819014274 > > Substrings will work that out, though GMT might make it easier. > > regards DaveP I have modified the output of the URL 'http://xobjex.com/cgi-bin/date.pl' to produce timezones (local, and utc), a XML Schema friendly stamp, and component data for each date. Like this: <?xml version="1.0" encoding="utf-8"?> <date> <local tz="PDT" stamp="2004-08-20T17:40:47"> <year>2004</year> <month>08</month> <day>20</day> <hour>17</hour> <minute>40</minute> <second>47</second> </local> <utc tz="GMT" stamp="2004-08-21T00:40:47"> <year>2004</year> <month>08</month> <day>21</day> <hour>00</hour> <minute>40</minute> <second>47</second> </utc> </date> So, David, you'll want to use it in a manner similar to these examples: <xsl:variable name="date" select="document('http://xobjex.com/cgi-bin/date.pl)/date"/> <xsl:variable name="stamp" select="$date/utc/@stamp"/> <!-- produces: On the third stroke it will be 2004-08-21T00:40:47 --> <h1> On the third stroke it will be <xsl:value-of select="$stamp"/> </h1> <!-- produces: In Santa Monica, California, the sun set at 7:34 PM PDT today. --> <p> <xsl:text>In Santa Monica, California, the sun set at 7:34 PM </xsl:text> <xsl:value-of select="$date/local/@tz"/> <xsl:text> today.</xsl:text> </p> <!-- produces: The date in London is 21-08-2004. --> <p> <xsl:text>The date in London is </xsl:text> <xsl:value-of select="concat( $date/utc/day, '-', $date/utc/month, '-', $date/utc/year )"/> <xsl:text>.</xsl:text> </p> <!-- produces: The date in Santa Monica is 20-08-2004. --> <p> <xsl:text>The date in London is </xsl:text> <xsl:value-of select="concat( $date/local/day, '-', $date/local/month, '-', $date/local/year )"/> <xsl:text>.</xsl:text> </p> --
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Retrieving the date of pr, David . Pawson | Thread | RE: [xsl] Retrieving the date of pr, Michael Kay |
[xsl] Another grouping question, William Jordan | Date | Re: [xsl] Encoding base64 with XSLT, Mukul Gandhi |
Month |