Hey, I just figured out how to do this yesterday!
In your sitemap, put in a transformer in your pipeline like this:

 <map:transform src="stylesheet.xslt">
   <map:parameter name='date'
                  value='{date:}'/>
 </map:transform>


Then, in your XSLT, declare the parameter:

 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
   . . .
  <xsl:param name='date'/>
   . . .


You might find that you want to change the format that the date appears in. To do that, edit your cocoon.xconf file (which, if you're like me, and running the installed web-app, is in $COCOON_HOME/build/webapp/WEB-INF). Search for "DateInputModule". Inside the "component-instance" element, uncomment the "format" element child, and change the format string, the syntax of which is defined here: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html.


Now, what I'd like to know is, is there any way to use this module to get different peices of the date (say, month and day, as separate parameters). That seems to me that that would be easier than trying to parse the date within XSLT.


Cheers!




Schultz, Gary - COMM wrote:

Thanks for the link. Unfortunately the documentation and examples on
DateInputModule are weak. I will experiment and write a wiki page if I get
something that works.

-----Original Message-----
From: Tony Collen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 26, 2005 1:21 PM
To: [email protected]
Subject: Re: Getting current date in Cocoon


Gary,

There's a DateInputModule that you could use to inject the current date into pipelines.

http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html#DateInputMod
ule


HTH,

Tony

Schultz, Gary - COMM wrote:


I'm trying to get the current date to compare against a Dublin core meta


tag


value. I can do this with JavaScript and PHP, but I would like to do this


in


Cocoon. Is there any way to get the current date in Cocoon and use it to
compare against an element attribute value. I know enough about XSP, XSLT,
etc to do the comparison. I just need to know if I can get the current


date.



Gary T. Schultz Web Administrator / GIS Coordinator Wisconsin Department of Commerce

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to