Changeset 1713

Show
Ignore:
Timestamp:
07/16/08 18:01:09 (2 months ago)
Author:
mikey
Message:

implement enhancement #159: XSL-Callback for formatting dates and timestamps

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework/trunk/projects/dist/config/xsl-callbacks.ini

    r1608 r1713  
    11image="net::stubbles::xml::xsl::util::stubXSLImageDimensions" 
    22request="net::stubbles::xml::xsl::util::stubXSLRequestParams" 
     3date="net::stubbles::xml::xsl::util::stubXSLDateFormatter" 
  • framework/trunk/projects/examples/config/xsl-callbacks.ini

    r1219 r1713  
    11image="net::stubbles::xml::xsl::util::stubXSLImageDimensions" 
     2request="net::stubbles::xml::xsl::util::stubXSLRequestParams" 
     3date="net::stubbles::xml::xsl::util::stubXSLDateFormatter" 
  • framework/trunk/projects/examples/pages/txt/main_index.xml

    r1670 r1713  
    3535      <!-- This is an include from a different file --> 
    3636      <stub:include part="disclaimer" href="include/parts.xml"/> 
     37      <p>The current date is <stub:date format="Y-m-d"/>. Localized: <stub:localeDate format="%d %b %Y"/>.</p> 
     38      <p>A given date is <stub:date format="Y-m-d" timestamp="1214222717"/>. Localized: <stub:localeDate format="%d %b %Y" timestamp="1214222717"/>.</p> 
    3739    </div> 
    3840 
  • framework/trunk/src/main/resources/xsl/stub.xsl

    r1637 r1713  
    571571    </ixsl:if> 
    572572  </xsl:template> 
     573 
     574  <xsl:template match="stub:date"> 
     575    <xsl:value-of select="php:function('stubXSLCallback::invoke', 'date', 'formatDate', @format, @timestamp)"/> 
     576  </xsl:template> 
     577 
     578  <xsl:template match="stub:localeDate"> 
     579    <xsl:value-of select="php:function('stubXSLCallback::invoke', 'date', 'formatLocaleDate', @format, @timestamp)"/> 
     580  </xsl:template> 
     581 
    573582</xsl:stylesheet> 
  • framework/trunk/src/test/php/net/stubbles/xml/XMLTestSuite.php

    r1608 r1713  
    4646        $suite->addTestFile($dir . '/xsl/stubXSLCallbackTestCase.php'); 
    4747        $suite->addTestFile($dir . '/xsl/stubXSLProcessorTestCase.php'); 
     48        $suite->addTestFile($dir . '/xsl/util/stubXSLDateFormatterTestCase.php'); 
    4849        $suite->addTestFile($dir . '/xsl/util/stubXSLImageDimensionsTestCase.php'); 
    4950        $suite->addTestFile($dir . '/xsl/util/stubXSLRequestParamsTestCase.php');