You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2005/09/07 04:03:54 UTC

svn commit: r279209 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2: resources/stylesheets/prepare.xhtml.xsl resources/stylesheets/strip_namespaces.xsl structurer.xmap

Author: rgardler
Date: Tue Sep  6 19:03:17 2005
New Revision: 279209

URL: http://svn.apache.org/viewcvs?rev=279209&view=rev
Log:
added the views mathcers (both viewhelper and inernal.views) - doesn't work yet and we need to refactor

Added:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/resources/stylesheets/prepare.xhtml.xsl
      - copied unchanged from r279081, forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/resources/stylesheets/strip_namespaces.xsl
      - copied unchanged from r279081, forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/stylesheets/strip_namespaces.xsl
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/structurer.xmap   (with props)

Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/structurer.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/structurer.xmap?rev=279209&view=auto
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/structurer.xmap (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/structurer.xmap Tue Sep  6 19:03:17 2005
@@ -0,0 +1,393 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2005 The Apache Software Foundation or its licensors,
+  as applicable.
+
+  Licensed 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.
+-->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:components>
+    <map:generators>
+      <map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator" />
+      <map:generator 
+        name="traverse" 
+        src="org.apache.cocoon.generation.TraversableGenerator" 
+        logger="sitemap.generator.traverse" 
+        label="content" 
+        pool-max="16"
+      />
+    </map:generators>
+    <map:serializers>
+      <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html" name="xhtml" pool-grow="2" pool-max="64" pool-min="2" src="org.apache.cocoon.serialization.XMLSerializer">
+	      <!--+
+	          | You can choose from Strict, Transitional, or Frameset XHTML.
+	          | For Strict XHTML set doctype to:
+	          |   <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
+	          |   <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
+	          | For Transitional XHTML set doctype to:
+	          |   <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
+	          |   <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>
+	          | For Frameset XHTML set doctype to:
+	          |   <doctype-public>-//W3C//DTD XHTML 1.0 Frameset//EN</doctype-public>
+	          |   <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd</doctype-system>
+	          |
+	          | Default XHTML doctype in Cocoon is XHTML Strict. If you want to use more than one
+	          | XHTML DTD simultaneously, you can define several XHTML serializers.
+	          +-->
+        <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
+        <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
+        <encoding>UTF-8</encoding>
+      </map:serializer>
+    </map:serializers>
+
+    <map:actions>
+      <map:action name="fallbackResolverAction"
+          src="org.apache.forrest.acting.FallbackResolverAction"/>
+    </map:actions>
+
+  </map:components>
+
+  <map:pipelines>
+  
+  <!--
+    FIXME: Refactor
+    The follwoing pipeline is copied from viewhelper.xhtml/output.xmap.
+    We need to work through this pipline ensuring the matches are in the right xmap
+    and converting to use the locationmap where relevant.
+  
+  -->
+    <map:pipeline type="noncaching">
+  <!--
+    FIXME:
+    The next pipes have to be refactored and then to go into the view-interface (internal plugin)
+    e.g. resources/templates/{1}.ft -> should become 
+    first {project:view-skin}/templates/{1}.ft 
+    then {project:skin}/templates/{1}.ft
+    -->
+  <!--FIXME:START-->
+  <!--
+    Resolving factory
+    Project implementation of templates have priority before default ones.
+    If no implementation can be found we use the noFt (~ - no forrest:template) implementation.
+    {1} name of the contract-->
+      <map:match pattern="resolve.contract.xhtml.*">
+        <map:select type="exists">
+          <map:when test="{project:resources}/templates/{project:theme}/{1}.ft">
+            <map:generate src="{project:resources}/templates/{project:theme}/{1}.ft"/>
+          </map:when>
+          <map:when test="{project:resources}/templates/{1}.ft">
+            <map:generate src="{project:resources}/templates/{1}.ft"/>
+          </map:when>
+          <map:when test="{forrest:plugins}/templates/{1}.ft">
+            <map:generate src="{forrest:plugins}/templates/{1}.ft"/>
+          </map:when>
+          <map:when test="resources/templates/{project:theme}/{1}.ft">
+            <map:generate src="resources/templates/{project:theme}/{1}.ft"/>
+          </map:when>
+          <map:when test="resources/templates/{1}.ft">
+            <map:generate src="resources/templates/{1}.ft"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="resources/templates/noFt.ft"/>
+          </map:otherwise>
+        </map:select>
+        <map:serialize type="xml"/>
+      </map:match>
+  
+  <!--This activates forrest:call-templates includes into the view.-->
+      <map:match pattern="prepare.view-templates.**">
+        <map:select type="exists">
+          <map:when test="{project:resources}/templates/{project:theme}/{1}.vt.xml">
+            <map:generate src="{project:resources}/templates/{project:theme}/{1}.vt.xml"/>
+          </map:when>
+          <map:when test="{project:resources}/templates/{1}.vt.xml">
+            <map:generate src="{project:resources}/templates/{1}.vt.xml"/>
+          </map:when>
+          <map:when test="resources/templates/{project:theme}/{1}.vt.xml">
+            <map:generate src="resources/templates/{project:theme}/{1}.vt.xml"/>
+          </map:when>
+          <map:when test="resources/templates/{1}.vt.xml">
+            <map:generate src="resources/templates/{1}.vt.xml"/>
+          </map:when>
+      <!-- otherwiser no view Tiles not found -->
+        </map:select>
+        <map:transform src="{defaults:view-internal}/resources/stylesheets/prepare.include.templates.xsl"/>
+        <map:transform type="xinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+  
+   <!-- <!-#-INTERFACE
+    Get the xsl:templates of the requested contract.
+  {1} format to deliver
+  {2} contract name-#->
+   <map:match pattern="get.contract.*.*">
+     <map:generate src="cocoon:/resolve.contract.{2}"/>
+     <map:transform src="resources/stylesheets/contract.xsl">
+      <!-#-Which output format?-#->
+      <map:parameter name="format" value="{1}"/>
+     </map:transform>
+     <map:serialize type="xml"/>
+   </map:match>-->
+  
+  <!--IMPLEMENTATION
+    Get the xsl:templates of the requested contract.
+  {html} format to deliver
+  {2} contract name-->
+      <map:match pattern="get.contract.*.xhtml">
+        <map:generate src="cocoon:/resolve.contract.xhtml.{1}"/>
+        <map:transform src="resources/stylesheets/contract.xsl">
+      <!--Which output format?-->
+          <map:parameter name="format" value="xhtml"/>
+        </map:transform>
+        <map:transform type="i18n">
+          <map:parameter name="locale" value="{request:locale}"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+  <!--
+  Get the forrest:properties of the requested contract. 
+  This will determine which templates (css, head, body) we have to call later on
+  {1} format to deliver
+  {2} contract name
+  -->
+      <map:match pattern="get.contract-property.*.xhtml">
+        <map:generate src="cocoon:/resolve.contract.xhtml.{1}"/>
+        <map:transform src="resources/stylesheets/contract.property.xsl">
+      <!--Which output format?-->
+          <map:parameter name="format" value="xhtml"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+  <!--
+  Get the css of the requested contract {1}. 
+  -->
+<!--   <map:match pattern="get.contract-css.*">
+     <map:generate src="cocoon:/resolve.contract.xhtml.{1}"/>
+     <map:transform src="resources/stylesheets/contract.css.xsl"/>
+     <map:serialize type="txt"/>
+   </map:match>-->
+<!--FIXME:END-->
+<!--
+    FIXME:
+    The next pipes have to be refactored and then to go into an input plugin
+    e.g. resources/templates -> should become 
+    first {project:view-skin}/templates 
+    then {project:skin}/templates
+    -->
+  <!--FIXME:START-->
+<!-- ls.fbits 
+  list the default fbits-->
+    <map:pipeline>
+      <map:match pattern="ls.contracts">
+        <map:generate type="directory" src="resources/templates">
+          <map:parameter name="depth" value="1"/>
+        <!-- sorted alphabetically -->
+          <map:parameter name="reverse" value="false"/>
+        </map:generate>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+<!-- ls.fbits 
+  list the project fbits-->
+    <map:pipeline>
+      <map:match pattern="ls.contracts.project">
+        <map:generate type="directory" src="{project:resources}/templates/">
+          <map:parameter name="depth" value="1"/>
+        <!-- sorted alphabetically -->
+          <map:parameter name="reverse" value="false"/>
+        </map:generate>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+
+    <map:pipeline>
+<!--
+  Debug pipes - JTidy output
+  -->
+      <map:match pattern="*.tidy">
+        <map:generate type="html" src="cocoon:/{1}.html"/>
+        <map:serialize type="xhtml"/>
+      </map:match>
+      <map:match pattern="**/*.tidy">
+        <map:generate type="html" src="cocoon:/{1}/{2}.html"/>
+        <map:serialize type="xhtml"/>
+      </map:match>
+  <!--
+  Last processing step. 
+  Here we are overriding the default skin generation.
+  -->
+      <map:match pattern="*.html">
+        <map:generate src="cocoon://{1}.xml"/>
+        <map:transform src="cocoon://getStylesheet.xhtml.{1}">
+          <map:parameter name="path" value="{0}"/>
+        </map:transform>
+        <map:transform src="resources/stylesheets/strip_namespaces.xsl"/>
+        <map:serialize type="xhtml"/>
+      </map:match>
+
+      <map:match pattern="**/*.html">
+        <map:generate src="cocoon://{1}/{2}.page"/>
+        <map:transform src="cocoon://getStylesheet.xhtml.{1}/{2}">
+          <map:parameter name="path" value="{0}"/>
+        </map:transform>
+        <map:transform src="resources/stylesheets/strip_namespaces.xsl"/>
+        <map:serialize type="xhtml"/>
+      </map:match>
+
+      <map:match pattern="**.js">
+        <map:mount uri-prefix="" src="resources.xmap" check-reload="yes" />
+      </map:match>
+      <map:match pattern="**.css">
+        <map:mount uri-prefix="" src="resources.xmap" check-reload="yes" />
+      </map:match>
+      <map:match pattern="**images**">
+        <map:mount uri-prefix="" src="resources.xmap" check-reload="yes" />
+      </map:match>
+      <map:match pattern="**.png">
+        <map:mount uri-prefix="" src="resources.xmap" check-reload="yes" />
+      </map:match>
+      <map:match pattern="**.ico">
+        <map:mount uri-prefix="" src="resources.xmap" check-reload="yes" />
+      </map:match>
+    </map:pipeline>
+    
+<!--
+   FIXME: Refactor
+   The following pipeline is a copy of the interal.xmap from the internal.view plugin
+   It needs refactoring to ensure that all matches are in the right sitemap and it uses
+   the locationmap where appropriate.
+ -->
+    
+<!--
+  This plugin has x components:
+  2. businessHelper - delivers content that is used in the contracts
+  3. views - transforms the requested contracts (viewHelper) 
+     and populate them with the content (businessHelper)
+  -->
+
+
+
+<!--
+  3. views
+  prepares and transforms the requested contracts (viewHelper) and populate them with the content (businessHelper).
+  -->
+  <!--FIXME: We should refactor this pipeline when we want to use it-->
+    <map:pipeline type="noncaching">
+    <!--Refactor for dir-->
+      <map:match pattern="viewLocationmap.xml">
+        <map:generate type="traverse" src="{project:content.xdocs}">
+          <map:parameter name="depth" value="100"/>
+          <map:parameter name="exclude" value="[\w]*.svn"/>
+        <!--<map:parameter name="include" value="[\w]*.fv"/>-->
+        </map:generate>
+        <map:transform src="resources/stylesheets/viewLocationmap.xsl"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    
+
+  <!--
+    View config resolver
+    File specific views have priority before default ones.
+    If no views can be found in the project we use the default one of the view plugin.
+    {1} - requested url
+    -->
+      <map:match pattern="prepare.view.**">
+        <map:act type="fallbackResolverAction">
+          <map:parameter value="{1}" name="request"/>
+          <map:parameter value="{project:theme}" name="projectFallback"/>
+          <map:parameter value="{project:theme-ext}" name="projectExtension"/>
+          <map:parameter value="{project:content.xdocs}" name="projectDir"/>
+          <map:parameter value="{defaults:view-themes}" name="defaultDir"/>
+          <map:parameter value="{defaults:theme}" name="defaultFallback"/>
+          <map:parameter value="{defaults:theme-ext}" name="defaultExtension"/>
+
+          <map:generate src="file:/{uri}"/>
+          <map:transform src="resources/stylesheets/prepare.include.templates.xsl"/>
+          <map:transform type="xinclude"/>
+          <map:serialize type="xml"/>
+        </map:act>
+      </map:match>
+    
+    <!--Add businessHelper to the presentation model that the content can be used later on.
+        {1} - requested url-->
+
+      <map:match pattern="prepare.view-nugget.**">
+        <map:generate src="cocoon:/prepare.view.{1}"/>
+        <map:transform src="resources/stylesheets/prepare.view.xsl">
+          <map:parameter name="view" value="{1}"/>
+        </map:transform>
+        <map:transform type="xinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    
+<!--
+  Aggregate the contract-templates requested by the view with xinclude.
+  The result is a stylesheet with all needed xsl:templates.
+  {1} - format
+  {2} - requested url
+  -->
+      <map:match pattern="prepare.include.*.**">
+        <map:generate src="cocoon:/prepare.view.{2}"/>
+        <map:transform src="resources/stylesheets/prepare.include.xsl">
+          <map:parameter name="config-file" value="{project:skinconf}"/>
+        <!--Which output format?-->
+          <map:parameter name="format" value="{1}"/>
+        </map:transform>
+        <map:transform type="xinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    
+    <!--
+      Aggregate the forrest:properties requested by the *.fv.
+      The result is an aggregation of properties which defines the templates to be call.
+      {1} - format
+  		{2} - requested url
+      -->
+      <map:match pattern="prepare.properties.*.**">
+        <map:generate src="cocoon:/prepare.view.{2}"/>
+        <map:transform src="resources/stylesheets/prepare.properties.xsl">
+        <!--Which output format?-->
+          <map:parameter name="format" value="{1}"/>
+        </map:transform>
+        <map:transform type="xinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    <!--FIXME
+      This has to be an interface and not an implementation
+      
+      An interface will only generate cocoon protocol matches and serialize them!
+      An implementation will deliver the actual match (including transformation)-->
+    <!--
+      Aggregate all contracts-templates requested by the view.
+      Create a xsl that can be used for the last step of the transformation of the view.
+      {1} - format
+      {2} - requested url
+  		-->
+      <map:match pattern="getStylesheet.*.**">
+        <map:aggregate element="forrest:filter">
+          <map:part src="cocoon://prepare.view.{2}" />
+          <map:part src="cocoon://prepare.properties.{1}.{2}" />
+        </map:aggregate>
+        <map:transform src="resources/stylesheets/prepare.{1}.xsl">
+          <map:parameter name="request" value="{2}"/>
+          <map:parameter name="forrestContext" value="{forrest:context}"/>
+        </map:transform>
+        <map:transform type="xinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+  
+  </map:pipelines>
+</map:sitemap>

Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2/structurer.xmap
------------------------------------------------------------------------------
    svn:eol-style = native



Re: svn commit: r279209 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2: resources/stylesheets/prepare.xhtml.xsl resources/stylesheets/strip_namespaces.xsl structurer.xmap

Posted by Ross Gardler <rg...@apache.org>.
Thorsten Scherler wrote:
> On Wed, 2005-09-07 at 02:03 +0000, rgardler@apache.org wrote:
> 
>>Author: rgardler
>>Date: Tue Sep  6 19:03:17 2005
>>New Revision: 279209
>>
>>URL: http://svn.apache.org/viewcvs?rev=279209&view=rev
>>Log:
>>added the views mathcers (both viewhelper and inernal.views) - doesn't work yet and we need to refactor
> 
> 
> Yes because with this commit we are mixing internal and output plugin.
> Or using other words we are missing the core code responsible for the
> view with code for viewHelper. That is bad.

Yes - see "need to refactror" in the commit message and discussion in 
IRC just before this commit.

Ross

Re: svn commit: r279209 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.xhtml2: resources/stylesheets/prepare.xhtml.xsl resources/stylesheets/strip_namespaces.xsl structurer.xmap

Posted by Thorsten Scherler <th...@apache.org>.
On Wed, 2005-09-07 at 02:03 +0000, rgardler@apache.org wrote:
> Author: rgardler
> Date: Tue Sep  6 19:03:17 2005
> New Revision: 279209
> 
> URL: http://svn.apache.org/viewcvs?rev=279209&view=rev
> Log:
> added the views mathcers (both viewhelper and inernal.views) - doesn't work yet and we need to refactor

Yes because with this commit we are mixing internal and output plugin.
Or using other words we are missing the core code responsible for the
view with code for viewHelper. That is bad.

> 
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)