[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Retrieving the date of processing

Subject: Re: Retrieving the date of processing
From: Daniel Bibbens <dbibbens@xxxxxxxxxx>
Date: Fri, 20 Aug 2004 20:14:14 -0500
date.pl
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.