cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Schulze" <markus.schu...@bg-sys.de>
Subject Re: FYI: Date Input Module and date formatting
Date Mon, 16 Jun 2003 11:53:35 GMT
Hello,

I am a little bit confused:

with DateInputModule from cocoon-2.1m3-dev 2003/03/09 (@version CVS $Id:
DateInputModule.java,v 1.1 2003/03/09 00:09:02 pier Exp $),
which seems be the newest version, only one date-format can be passed to
the XSL.
It has to be specified in the <format></format> tags in cocoon.xconf.
Additional tags, as described by
Perry Molendijk below, are not passed to the XSL.

Hence:
cocoon.xconf:
<component-instance class
="org.apache.cocoon.components.modules.input.DateInputModule"
  logger="core.modules.input"
  name="date">
  <format>EEE, d MMM yyyy HH:mm:ss</format>
</component-instance>

sitemap:
<map:transform type="xslt" src="style/main.xsl">
<map:parameter name="thecurrentdate" value="{date:format}"/>
...

delivers the expected result. But

cocoon.xconf:
<component-instance class
="org.apache.cocoon.components.modules.input.DateInputModule"
  logger="core.modules.input"
  name="date">
  <format-something>EEE, d MMM yyyy HH:mm:ss</format-something>
</component-instance>

sitemap:
<map:transform type="xslt" src="style/main.xsl">
<map:parameter name="thecurrentdate" value="{date:format-something}"/>

delivers the "default" date formatting and not the "format-something".

Did I mix up cocoon-versions or misunderstood something?

Markus


> "Perry Molendijk" <xions () iinet ! net ! au>
>
>  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.




Markus Schulze





---------------------------------------------------------------------
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