You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bernhard Huber <bh...@i-one.at> on 2002/07/08 02:26:51 UTC

[ANN] DateSelector

Hi,
inspired by the xmas style sample in the RT CocoonBlocks
i put a DateSelector into the scratchpad area.
any comments are welcome...

Configuring and usage sample of the DateSelector,
    The configuration of DataSelector configures a symbolic name (ie 
'morning'),
    a compare-mode (ie <before>), and a date-time value (ie '06:00:00').

    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 
time
     areas, each spanning six hours, giving them symbolic names night, 
morning,
     afternoon, and evening.
    <map:components>
    ...
      <map:selectors default="browser">
      ...
        <map:selector type="date" 
src="org.apache.cocoon.selection.DateSelector">
          <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"/>
        </map:selector>
      ...
      </map:selectors>
    ...
    </map:components>
    <map:pipelines>
      <map:pipeline>
      ...
        <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>
          <map:when test="morning">
            <!-- do something for night publishing -->
            <map:read src="resources/{2}-morning.css" mime-type="text/css>
          </map:when>
          ...
          <map:otherwise>
            <!-- define for completness, and if selecting fails due to 
errors -->
          </map:otherwise>
        </map:select>
      </map:pipeline>
    </map:pipelines>

bye bernhard




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