cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernhard Huber <>
Subject [ANN] DateSelector in scratchpad
Date Mon, 08 Jul 2002 05:53:45 GMT
Inspired by the xmas style example of the RT CocoonBlocks
discussion I implemented a DateSelector.
Any comments are welcome
bye bernhard

The docu taken from the java source:

   A Selector depending on current date, and time.

    This selector matches when a configured date is before, respectivly
    after the current date, and time.

    You may want to use this selector to make the pipeline behaviour time

    The configuration of DataSelector configures for a symbolic name
    a compare-mode, and a date-time value.

    The compare mode is specified by the element name before, or after.
    The date-time value is specified by the attribute date. The attribute
    dateformat specifies the dateformat of the date-time value. Time 
only values
    are relative to the current date. Optionally you specify a country, and
    a language attribute for specifying the locale used in the 
date-value parsing.
    Per default the default locale is used.

     The following configuration example, sets partition a day into four 
     areas, each spanning six hours, giving them symbolic names night, 
     afternoon, and evening.

      <map:selectors default="browser">
        <map:selector type="date" 
          <before name="night" date="06:00:00" dateformat="HH:mm:ss"/>
          <before name="morning" date="12:00:00" dateformat="HH:mm:ss"/>
          <before name="afternoon" date="18:00:00" dateformat="HH:mm:ss"/>
          <before name="evening" date="23:59:59" dateformat="HH:mm:ss"/>

    The above date selector definition is used to control the behaviour of a
    pipeline processing depending on the current time of day.

        <map:match pattern="&asterik;&asterik;/resources/*.css">
        <map:select type="date">
          <map:when test="night">
            <!-- do something for night publishing -->
            <map:read src="resources/{2}-night.css" mime-type="text/css>
          <map:when test="morning">
            <!-- do something for night publishing -->
            <map:read src="resources/{2}-morning.css" mime-type="text/css>
            <!-- define for completness, and if selecting fails due to 
errors -->

To unsubscribe, e-mail:
For additional commands, email:

View raw message