forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r159468 - in forrest/trunk: main/webapp/skins/leather-dev/xslt/html/ plugins/org.apache.forrest.plugin.views/ plugins/org.apache.forrest.plugin.views/resources/nuggets/ plugins/org.apache.forrest.plugin.views/resources/stylesheets/ plugins/org.apache.forrest.plugin.views/resources/templates/ plugins/org.apache.forrest.plugin.views/src/documentation/
Date Wed, 30 Mar 2005 07:57:29 GMT
Author: thorsten
Date: Tue Mar 29 23:57:27 2005
New Revision: 159468

URL: http://svn.apache.org/viewcvs?view=rev&rev=159468
Log:
added an example of a nugget calling template. It is taken from the feeder plugin and can
be seen as usecase for nuggets. The idea to commmit the nuggets and the contract back to the
feeder plugin if we think that is a good idea. I ended up with this solution because we have
to discuss how we are going to provide nuggets that is coming from plugin. 

Added:
    forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/nuggets/
    forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/nuggets/feeder.fn
    forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/nugget.xsl
  (with props)
    forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.view.xsl
  (with props)
    forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/feeder.ft
Modified:
    forrest/trunk/main/webapp/skins/leather-dev/xslt/html/document2html.xsl
    forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap
    forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/default.fv

Modified: forrest/trunk/main/webapp/skins/leather-dev/xslt/html/document2html.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/leather-dev/xslt/html/document2html.xsl?view=diff&r1=159467&r2=159468
==============================================================================
--- forrest/trunk/main/webapp/skins/leather-dev/xslt/html/document2html.xsl (original)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/html/document2html.xsl Tue Mar 29 23:57:27
2005
@@ -92,7 +92,7 @@
     <xsl:choose>
       <xsl:when test="$level=1">
         <div class="skinconf-heading-{$level}">
-          <h1><xsl:value-of select="title"/></h1>  test - 
+          <h1><xsl:value-of select="title"/></h1>
         </div>
         <div class="section">
 			<xsl:apply-templates select="*[not(self::title)]"/>

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap?view=diff&r1=159467&r2=159468
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap Tue Mar 29 23:57:27
2005
@@ -106,7 +106,7 @@
      </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
   -->
@@ -205,7 +205,7 @@
           <map:part src="cocoon://tab-{1}.html"/>
           <map:part src="cocoon://menu-{1}.html"/>
           <map:part src="cocoon://body-{1}.html"/>
-          <map:part src="cocoon:/prepare.view.{1}"/>
+          <map:part src="cocoon:/prepare.view-nugget.{1}"/>
         </map:aggregate>
         <map:serialize type="xml"/>
     </map:match>
@@ -216,11 +216,31 @@
           <map:part src="cocoon://{1}/tab-{2}.html"/>
           <map:part src="cocoon://{1}/menu-{2}.html"/>
           <map:part src="cocoon://{1}/body-{2}.html"/>
-          <map:part src="cocoon:/prepare.view.{1}"/>
+          <map:part src="cocoon:/prepare.view-nugget.{2}"/>
         </map:aggregate>
         <map:serialize type="xml"/>
       </map:match>
+  <!--
+    Get the nugget (xml) of the requested contract.
+  -->
+   <map:match pattern="resolve.nugget.*.*">
+     <map:generate src="cocoon:/prepare.view.{2}"/>
+     <map:transform src="resources/stylesheets/nugget.xsl">
+      <map:parameter value="{1}" name="contract"/>
+     </map:transform>
+     <map:serialize type="xml"/>
+   </map:match>
+ 
+   <map:match pattern="get.nugget.*.*">
+	    <map:generate src="cocoon://resolve.nugget.{1}.{2}"/>
+      <!--FIXME: get resolved first-->
+	    <map:transform src="resources/nuggets/{1}.fn"/>
+	    <map:serialize type="xml"/>
+	 </map:match>
+   
   </map:pipeline>  
+
+  
 <!-- END
 	2. nuggets
 	-->
@@ -259,7 +279,15 @@
       </map:select>
      	<map:serialize type="xml"/>
     </map:match>
-    
+    <!--Add nuggets to the view that the content can be used later on.-->
+    <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.

Added: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/nuggets/feeder.fn
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/nuggets/feeder.fn?view=auto&rev=159468
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/nuggets/feeder.fn (added)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/nuggets/feeder.fn Tue
Mar 29 23:57:27 2005
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 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.
+-->
+
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:cinclude="http://apache.org/cocoon/include/1.0">
+  
+
+  <xsl:template match="feedDescriptor">
+    <rss version="2.0">
+      <xsl:apply-templates/>
+    </rss>
+  </xsl:template>
+  
+  <xsl:template match="feed">
+    <xsl:variable name="url" select="url"/>
+    <xsl:variable name="feed" select="document($url)"/>
+    <xsl:apply-templates select="$feed/rss/channel"/>
+  </xsl:template>
+
+  <xsl:template match="@*|*|text()|processing-instruction()|comment()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file

Added: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/nugget.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/nugget.xsl?view=auto&rev=159468
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/nugget.xsl
(added)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/nugget.xsl
Tue Mar 29 23:57:27 2005
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 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.
+-->
+<!--
+site2xml.xsl is the final stage in XML page production.  It merges HTML from
+document2html.xsl, tab2menu.xsl and book2menu.xsl, and adds the site header,
+footer, searchbar, css etc.  As input, it takes XML of the form:
+
+<elements>
+  <branding/>
+  <search/>
+  <menu/>
+  <content/>
+  <siteinfo/>
+</elements>
+
+-->
+
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:forrest="http://apache.org/forrest/templates/1.0">
+  
+  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
+  <xsl:strip-space elements="forrest:properties"/>
+  <xsl:param name="contract"/>
+  
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+  <xsl:template match="forrest:property[@name=$contract]">
+    <xsl:comment> properties <xsl:value-of select="$contract"/> </xsl:comment>
+    <xsl:copy-of select="*"/>
+  </xsl:template>
+  
+  <xsl:template match="forrest:property"/>
+
+</xsl:stylesheet>

Propchange: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/nugget.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.view.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.view.xsl?view=auto&rev=159468
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.view.xsl
(added)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.view.xsl
Tue Mar 29 23:57:27 2005
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 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.
+-->
+
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:forrest="http://apache.org/forrest/templates/1.0"  
+  xmlns:xi="http://www.w3.org/2001/XInclude"
+  xmlns:alias="http://www.w3.org/1999/XSL/TransformAlias">
+    <xsl:namespace-alias 
+         stylesheet-prefix="alias" result-prefix="xsl"/>
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
+  <xsl:strip-space elements="forrest:property"/>
+  
+ <xsl:param name="view"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="forrest:property[@nugget]">
+    <forrest:property name="{@name}"><xi:include href="cocoon://{@nugget}.{$view}"/></forrest:property>
+  </xsl:template>
+
+  <xsl:template match="@*|*|text()|processing-instruction()|comment()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+
+</xsl:stylesheet>

Propchange: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.view.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/feeder.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/feeder.ft?view=auto&rev=159468
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/feeder.ft (added)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/feeder.ft Tue
Mar 29 23:57:27 2005
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 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.
+-->
+
+<forrest:contract name="feeder" type="nugget"
+  xmlns:forrest="http://apache.org/forrest/templates/1.0">
+  <description>
+    This function will output the html feeder information.
+  </description>
+
+  <forrest:template
+  xmlns:forrest="http://apache.org/forrest/templates/1.0"
+  format="xhtml" name="feeder" inputFormat="xsl" body="true" head="false" css="true">
+
+      <xsl:stylesheet version="1.1" 
+        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+        xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+        
+        <xsl:template name="feeder-css">
+#feeder {
+    color: black;
+    background: #CFDCED;
+    text-align:center;
+    margin-top: 5px;
+}
+}</xsl:template>
+        
+	    <xsl:template name="feeder-body" >
+	      <xsl:param name="feeder"/>
+				<xsl:apply-templates select="$feeder"/>		    
+			</xsl:template>
+      
+      <xsl:template match="rss">
+        <div id="feeder">
+		      <h1><xsl:value-of select="channel/title"/></h1>
+		     <p><xsl:apply-templates select="channel/item"/></p>
+		    </div>
+      </xsl:template>
+      <xsl:template match="item">
+  <section>
+    <b><xsl:value-of select="title" disable-output-escaping="yes"/></b>
+    <p><a href="{link}"><xsl:value-of select="link"/></a></p>
+    <!--<p><xsl:value-of select="description" disable-output-escaping="yes"/></p>-->
+  </section>
+</xsl:template>
+      
+    </xsl:stylesheet>
+	</forrest:template>
+</forrest:contract>
\ No newline at end of file

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/default.fv
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/default.fv?view=diff&r1=159467&r2=159468
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/default.fv (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/default.fv Tue
Mar 29 23:57:27 2005
@@ -39,6 +39,25 @@
 			</forrest:hook>
 	  </forrest:contract>-->
   </forrest:hook>
+  <forrest:hook name="feedboxes">
+    <forrest:contract name="feeder">
+      <forrest:properties contract="feeder">
+        <forrest:property name="feeder" nugget="get.nugget.feeder">
+          <feedDescriptor>
+            <feed id="shows">
+	            <url>http://m11.btefnet.net/torrents/backend.xml</url>
+	          </feed>
+	          <feed id="sf">
+	            <url>http://sourceforge.net/export/rss2_projnews.php?group_id=96589</url>
+	          </feed>
+          </feedDescriptor>
+        </forrest:property>
+        <forrest:property name="feedConfig">
+          <feed id="planetJava" maxItem="10" descr="false"/>
+        </forrest:property>
+      </forrest:properties>
+    </forrest:contract>
+  </forrest:hook>
   <forrest:contract name="feedback"/>
   
 </forrest:view>



Mime
View raw message