You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Adriano Smith <or...@sify.com> on 2005/01/11 06:09:50 UTC

date in XSL

Is it possible to display the current date and time using XSL ?

RE: date in XSL

Posted by Mark Lundquist <ml...@wrinkledog.com>.
Hi Adriano,

> Adriano Smith a écrit :
>
> >Is it possible to display the current date and time using XSL ?

I would stay away from XSP :-)

Just use the DateInputModule in the sitemap:

	<transform src="x.xslt">
	   <parameter name="now" value="{Date:date}" />
	</transform>

In the XSTL:

	<xsl:stylesheet
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:dates="http://exslt.org/dates-and-times"
	   />
	   .
	   .
	   .
	   Current date and time:
	   <xsl:value-of
	       select="date:format($now, 'EEE, d MMM yyyy HH:mm:ss Z')"
	     />



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: date in XSL

Posted by Marc Salvetti <ma...@notremanou.net>.
What you can do is use a simple xsp :

<!--sitemap.xmap-->
     <map:match pattern="dateToday">
        <map:generate type="serverpages" src="logicsheets/dateToday.xsp"/>
        <map:serialize type="xml"/>
     </map:match>

<!--dateToday.xsp-->
<?xml version="1.0"?>
<xsp:page xmlns:xsp="http://apache.org/xsp">
 <xsp:logic> java.util.Calendar today = 
java.util.Calendar.getInstance(); </xsp:logic>
  <today>
    <year>
        <xsp:expr>today.get(java.util.Calendar.YEAR)</xsp:expr>
    </year>
    <month>
        <xsp:expr>today.get(java.util.Calendar.MONTH) + 1</xsp:expr>
    </month>
    <day>
        <xsp:expr>today.get(java.util.Calendar.DAY_OF_MONTH)</xsp:expr>
    </day>
  </today>
</xsp:page>

regards,

Marc
Adriano Smith a écrit :

>Is it possible to display the current date and time using XSL ?
>  
>
> <ht...@Bottom>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org