cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perry Molendijk" <xi...@iinet.net.au>
Subject FYI: Date Input Module and date formatting
Date Wed, 07 May 2003 15:38:14 GMT
Blank
 For anyone trying to come to grips with input modules. Below is what you
need to do if you want to make the current date in a particular format
available in the sitemap:

in cocoon.xconf look for:

<component-instance
class="org.apache.cocoon.components.modules.input.DateInputModule"
logger="core.modules.input" name="date"/>

and replace it with:

<component-instance
class="org.apache.cocoon.components.modules.input.DateInputModule"
logger="core.modules.input" name="date">
  <au-format>dd-EEE-yyyy</au-format>
  <us-format>MM-dd-yyyy</us-format>
  <format>EEE, MMM d, yyyy</format>
  <long-format>EEE, d MMM yyyy HH:mm:ss Z</long-format>
</component-instance>

in the sitemap snippet below is an example of passing the current date as a
parameter to an XSL:

<map:match pattern="**.pdf">
  <map:generate src="xdocs/{1}.xml"/>
  <map:transform src="stylesheets/xmlToFo.xsl">
  <map:parameter name="currentDate" value="{date:format}"/>
  </map:transform>
  <map:serialize type="fo2pdf"/>
</map:match>

You can replace {date:format} with {date:xxxxx} where xxxxx represents the
name of one of the tags added in cocoon.xconf.
e.g. {date:long-format} will give you a date in "EEE, d MMM yyyy HH:mm:ss Z"
format.

>From an error message I worked that the date input module must somehow use
the SimpleDateFormat, so for more information about the date formats
supported see the Java JDK docs on docs/api/java/text/SimpleDateFormat.html.

Thanks to Christian Haul for getting me on the right track.

Perry


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


Mime
View raw message