<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:date="http://exslt.org/dates-and-times">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <xsl:variable name="rawtime" select="date:time()"/>
    <xsl:variable name="zonelesstime">
      <xsl:choose>
        <xsl:when test="contains($rawtime,'Z')">
          <xsl:value-of select="substring-before($rawtime,'Z')"/>
        </xsl:when>
        <xsl:when test="contains($rawtime,'+')">
          <xsl:value-of select="substring-before($rawtime,'+')"/>
        </xsl:when>
        <xsl:when test="contains($rawtime,'-')">
          <xsl:value-of select="substring-before($rawtime,'-')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>date:time() didn't include proper time zone info</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="date" select="date:date()"/>
    <xsl:variable name="date-time" select="date:date-time()"/>
    <xsl:variable name="year" select="date:year()"/>
    <xsl:variable name="month-in-year" select="date:month-in-year()"/>
    <xsl:variable name="day-in-month" select="date:day-in-month()"/>
    <xsl:variable name="hour-in-day" select="date:hour-in-day()"/>
    <xsl:variable name="minute-in-hour" select="date:minute-in-hour()"/>
    <xsl:variable name="second-in-minute" select="date:second-in-minute()"/>
    <xsl:variable name="assembled-time" select="concat(format-number($hour-in-day,'00'),':',format-number($minute-in-hour,'00'),':',format-number($second-in-minute,'00'))"/>
    <result>
      <time><xsl:value-of select="$rawtime"/></time>
      <assembled-time><xsl:value-of select="$assembled-time"/></assembled-time>
      <comparison>
        <xsl:choose>
          <xsl:when test="$zonelesstime = $assembled-time">close enough</xsl:when>
          <xsl:otherwise>too different</xsl:otherwise>
        </xsl:choose>
      </comparison>
    </result>
  </xsl:template>
  
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="a.xml" htmlbaseurl="" outputurl="" processortype="xalan" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->