Author: crossley Date: Sun Oct 25 05:21:54 2009 New Revision: 829495 URL: http://svn.apache.org/viewvc?rev=829495&view=rev Log: Enabled use of EXSLT extensions via exslt.org stylesheets. See explanation at main/webapp/resources/stylesheets/exslt/ Import a stylesheet using locationmap "lm://transform-exslt/...". See example "EXSLT" in the 'forrest seed-sample' site. Issue: FOR-1176
Added: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-b/exslt.xml (with props) forrest/trunk/main/fresh-site/src/documentation/resources/stylesheets/demo-exslt-to-document.xsl (with props) forrest/trunk/main/webapp/resources/stylesheets/exslt/date/ forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/ forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/ forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/date.day-name.template.xsl (with props) Modified: forrest/trunk/LICENSE.txt forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml forrest/trunk/main/fresh-site/src/documentation/sitemap.xmap forrest/trunk/main/webapp/locationmap-transforms.xml forrest/trunk/site-author/status.xml Modified: forrest/trunk/LICENSE.txt URL: http://svn.apache.org/viewvc/forrest/trunk/LICENSE.txt?rev=829495&r1=829494&r2=829495&view=diff ============================================================================== --- forrest/trunk/LICENSE.txt (original) +++ forrest/trunk/LICENSE.txt Sun Oct 25 05:21:54 2009 @@ -323,7 +323,7 @@ ---------------- These supporting products are licensed: Creative Commons - Attribution-Share Alike -main/webapp/resources/stylesheets/exslt/exslt-license.txt +license: main/webapp/resources/stylesheets/exslt/exslt-license.txt ---------------- These supporting products are licensed: W3C Software Notice and License Added: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-b/exslt.xml URL: http://svn.apache.org/viewvc/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-b/exslt.xml?rev=829495&view=auto ============================================================================== --- forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-b/exslt.xml (added) +++ forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-b/exslt.xml Sun Oct 25 05:21:54 2009 @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<?schema demo/exslt/1.0?> +<document> + <header> + <title>Use EXSLT Extensions provided by exslt.org</title> + </header> + <body> + <section id="introduction"> + <title>Introduction</title> + <p> + The EXSLT Extensions are provided by <a href="http://exslt.org/">exslt.org</a> + </p> + <p> + See the instructions in + <code>$FORREST_HOME/main/webapp/resources/stylesheets/exslt/README.txt</code> + for copying other EXSLT resources. + </p> + <p> + See the example stylesheet for this demo at + <code>src/documentation/resources/stylesheets/demo-exslt-to-document.xsl</code> + </p> + </section> + <section id="demo"> + <title>Demonstration</title> + <p> + The "date" below is handled using the "date.day-name" XSLT template. + </p> + <p> + The Apache Software Foundation was + <a href="http://www.apache.org/foundation/records/incorporator.html">incorporated</a> + on 1 June 1999 which was a + <strong><date>1999-06-01</date></strong>. + </p> + </section> + </body> +</document> Propchange: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-b/exslt.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml URL: http://svn.apache.org/viewvc/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml?rev=829495&r1=829494&r2=829495&view=diff ============================================================================== --- forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml (original) +++ forrest/trunk/main/fresh-site/src/documentation/content/xdocs/site.xml Sun Oct 25 05:21:54 2009 @@ -74,6 +74,8 @@ <xi:include href="site-xinclude.xml"/> <no-dtd label="No DTD" href="no-dtd.html" description="Process xml source documents without DTD declaration"/> + <exslt label="EXSLT" href="exslt.html" + description="Use EXSLT Extensions provided by exslt.org"/> <faq label="FAQ" href="faq.html" description="Frequently Asked Questions"/> <locationmap label="Locationmap" href="locationmap/index.html" description="Locationmaps allow the user URL space to be different from the storage URL Space"/> Added: forrest/trunk/main/fresh-site/src/documentation/resources/stylesheets/demo-exslt-to-document.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/fresh-site/src/documentation/resources/stylesheets/demo-exslt-to-document.xsl?rev=829495&view=auto ============================================================================== --- forrest/trunk/main/fresh-site/src/documentation/resources/stylesheets/demo-exslt-to-document.xsl (added) +++ forrest/trunk/main/fresh-site/src/documentation/resources/stylesheets/demo-exslt-to-document.xsl Sun Oct 25 05:21:54 2009 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + <xsl:import href="lm://transform-exslt/date/functions/day-name/date.day-name.template.xsl"/> + <xsl:import href="lm://transform.xml.copyover.helper"/> + <xsl:template match="date"> + <xsl:call-template name="date:day-name"> + <xsl:with-param name="date-time" select="."/> + </xsl:call-template> + </xsl:template> +</xsl:stylesheet> Propchange: forrest/trunk/main/fresh-site/src/documentation/resources/stylesheets/demo-exslt-to-document.xsl ------------------------------------------------------------------------------ svn:eol-style = native Modified: forrest/trunk/main/fresh-site/src/documentation/sitemap.xmap URL: http://svn.apache.org/viewvc/forrest/trunk/main/fresh-site/src/documentation/sitemap.xmap?rev=829495&r1=829494&r2=829495&view=diff ============================================================================== --- forrest/trunk/main/fresh-site/src/documentation/sitemap.xmap (original) +++ forrest/trunk/main/fresh-site/src/documentation/sitemap.xmap Sun Oct 25 05:21:54 2009 @@ -19,9 +19,16 @@ <map:components> <map:actions> <map:action logger="sitemap.action.sourcetype" name="sourcetype" src="org.apache.forrest.sourcetype.SourceTypeAction"> +<!-- + These actions are additional sourcetype demonstrations. + See the main definitions at main/webapp/forrest.xmap +--> <sourcetype name="hello-v1.0"> <document-declaration public-id="-//Acme//DTD Hello Document V1.0//EN" /> </sourcetype> + <sourcetype name="demo-exslt-v10"> + <processing-instruction target="schema" data="demo/exslt/1.0"/> + </sourcetype> </map:action> </map:actions> <map:selectors default="parameter"> @@ -38,6 +45,11 @@ <map:transform src="{properties:resources.stylesheets}/hello2document.xsl" /> <map:serialize type="xml-document"/> </map:when> + <map:when test="demo-exslt-v10"> + <map:generate src="{properties:content.xdocs}{../../1}.xml" /> + <map:transform src="{properties:resources.stylesheets}/demo-exslt-to-document.xsl" /> + <map:serialize type="xml-document"/> + </map:when> </map:select> </map:act> </map:resource> Modified: forrest/trunk/main/webapp/locationmap-transforms.xml URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/locationmap-transforms.xml?rev=829495&r1=829494&r2=829495&view=diff ============================================================================== --- forrest/trunk/main/webapp/locationmap-transforms.xml (original) +++ forrest/trunk/main/webapp/locationmap-transforms.xml Sun Oct 25 05:21:54 2009 @@ -105,7 +105,13 @@ <location src="{forrest:forrest.stylesheets}/declare-broken-site-links.xsl" /> </match> <!-- ================================== --> -<!-- aggregate transforms --> +<!-- exslt transforms --> +<!-- ================================== --> + <match pattern="transform-exslt/**"> + <location src="{forrest:forrest.stylesheets}/exslt/{1}"/> + </match> +<!-- ================================== --> +<!-- aggregate transforms --> <!-- ================================== --> <match pattern="transform-aggregate.linkmap.relativized-linkmap"> <location src="{forrest:forrest.stylesheets}/aggregates/relativize-split-linkmap.xsl" /> Added: forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/date.day-name.template.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/date.day-name.template.xsl?rev=829495&view=auto ============================================================================== --- forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/date.day-name.template.xsl (added) +++ forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/date.day-name.template.xsl Sun Oct 25 05:21:54 2009 @@ -0,0 +1,115 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:date="http://exslt.org/dates-and-times" + extension-element-prefixes="date"> + +<xsl:param name="date:date-time" select="'2000-01-01T00:00:00Z'" /> + +<date:month-lengths> + <date:month>31</date:month> + <date:month>28</date:month> + <date:month>31</date:month> + <date:month>30</date:month> + <date:month>31</date:month> + <date:month>30</date:month> + <date:month>31</date:month> + <date:month>31</date:month> + <date:month>30</date:month> + <date:month>31</date:month> + <date:month>30</date:month> + <date:month>31</date:month> +</date:month-lengths> + +<date:days> + <date:day abbr="Sun">Sunday</date:day> + <date:day abbr="Mon">Monday</date:day> + <date:day abbr="Tue">Tuesday</date:day> + <date:day abbr="Wed">Wednesday</date:day> + <date:day abbr="Thu">Thursday</date:day> + <date:day abbr="Fri">Friday</date:day> + <date:day abbr="Sat">Saturday</date:day> +</date:days> + +<xsl:template name="date:day-name"> + <xsl:param name="date-time"> + <xsl:choose> + <xsl:when test="function-available('date:date-time')"> + <xsl:value-of select="date:date-time()" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$date:date-time" /> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + <xsl:variable name="neg" select="starts-with($date-time, '-')" /> + <xsl:variable name="dt-no-neg"> + <xsl:choose> + <xsl:when test="$neg or starts-with($date-time, '+')"> + <xsl:value-of select="substring($date-time, 2)" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$date-time" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dt-no-neg-length" select="string-length($dt-no-neg)" /> + <xsl:variable name="timezone"> + <xsl:choose> + <xsl:when test="substring($dt-no-neg, $dt-no-neg-length) = 'Z'">Z</xsl:when> + <xsl:otherwise> + <xsl:variable name="tz" select="substring($dt-no-neg, $dt-no-neg-length - 5)" /> + <xsl:if test="(substring($tz, 1, 1) = '-' or + substring($tz, 1, 1) = '+') and + substring($tz, 4, 1) = ':'"> + <xsl:value-of select="$tz" /> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="day-of-week"> + <xsl:if test="not(string($timezone)) or + $timezone = 'Z' or + (substring($timezone, 2, 2) <= 23 and + substring($timezone, 5, 2) <= 59)"> + <xsl:variable name="dt" select="substring($dt-no-neg, 1, $dt-no-neg-length - string-length($timezone))" /> + <xsl:variable name="dt-length" select="string-length($dt)" /> + <xsl:variable name="year" select="substring($dt, 1, 4)" /> + <xsl:variable name="leap" select="(not($year mod 4) and $year mod 100) or not($year mod 400)" /> + <xsl:variable name="month" select="substring($dt, 6, 2)" /> + <xsl:variable name="day" select="substring($dt, 9, 2)" /> + <xsl:if test="number($year) and + substring($dt, 5, 1) = '-' and + $month <= 12 and + substring($dt, 8, 1) = '-' and + $day <= 31 and + ($dt-length = 10 or + (substring($dt, 11, 1) = 'T' and + substring($dt, 12, 2) <= 23 and + substring($dt, 14, 1) = ':' and + substring($dt, 15, 2) <= 59 and + substring($dt, 17, 1) = ':' and + substring($dt, 18) <= 60))"> + <xsl:variable name="month-days" select="sum(document('')/*/date:month-lengths/date:month[position() < $month])" /> + <xsl:variable name="days"> + <xsl:choose> + <xsl:when test="$leap and $month > 2"> + <xsl:value-of select="$month-days + $day + 1" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$month-days + $day" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y-1" select="$year - 1" /> + <xsl:value-of select="(($y-1 + floor($y-1 div 4) - + floor($y-1 div 100) + floor($y-1 div 400) + + $days) + mod 7) + 1" /> + </xsl:if> + </xsl:if> + </xsl:variable> + <xsl:value-of select="document('')/*/date:days/date:day[number($day-of-week)]" /> +</xsl:template> + +</xsl:stylesheet> Propchange: forrest/trunk/main/webapp/resources/stylesheets/exslt/date/functions/day-name/date.day-name.template.xsl ------------------------------------------------------------------------------ svn:eol-style = native Modified: forrest/trunk/site-author/status.xml URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/status.xml?rev=829495&r1=829494&r2=829495&view=diff ============================================================================== --- forrest/trunk/site-author/status.xml (original) +++ forrest/trunk/site-author/status.xml Sun Oct 25 05:21:54 2009 @@ -154,6 +154,10 @@ <link href="site:upgrading_09">upgrading to v0.9</link> </action> <!-- 2009-10 --> + <action context="code" type="add" dev="DC" fixes-bug="FOR-1176" importance="high"> + Enabled use of EXSLT extensions via exslt.org stylesheets. + See example "EXSLT" in the 'forrest seed-sample' site. + </action> <action context="code" type="add" dev="DC" fixes-bug="FOR-1178" importance="high"> Enabled the filtering of output messages from Ant (see <link href="site:faq/verbose-ant">FAQ</link>) @@ -166,7 +170,7 @@ <!-- 2009-06 --> <action context="code" type="add" dev="DC" fixes-bug="FOR-1173" importance="high"> Added a demonstration of using xml source documents without declaring a - DTD. See example "no-dtd" in the 'forrest seed sample' site. + DTD. See example "no-dtd" in the 'forrest seed-sample' site. </action> <action context="code" type="add" dev="DC" fixes-bug="FOR-1172" importance="high"> Added the ability to use RELAXNG to validate intermediate xml. @@ -232,11 +236,11 @@ </action> <!-- 2008-08 --> <action context="docs" type="add" dev="DC" fixes-bug="FOR-814" due-to="Carlos Tejo"> - Added example of using XInclude to the 'forrest seed sample' site. + Added example of using XInclude to the 'forrest seed-sample' site. </action> <action context="code" type="update" dev="DC" fixes-bug="FOR-1032"> Added ability to use XInclude to the document-v20 xdoc DTD. - See an example in a 'forrest seed sample' site. + See an example in a 'forrest seed-sample' site. </action> <!-- 2008-03 --> <action context="code" type="add" dev="DC" fixes-bug="FOR-1071"