forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: rev 56659 - in forrest/trunk/main/webapp/skins/leather-dev/xslt/xml: . fct-bits
Date Fri, 05 Nov 2004 12:56:34 GMT
Author: thorsten
Date: Fri Nov  5 04:56:33 2004
New Revision: 56659

Added:
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/contract.xsl   (contents, props changed)
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/dir2contracts.xsl   (contents, props
changed)
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.xsl   (contents,
props changed)
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/pipeline.txt   (contents,
props changed)
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/sitemap.xmap   (contents, props changed)
Modified:
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/c-fontsize-fct.xml
   forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.txt
Log:
started to implemend the cocoon pipelines. The directory generator works fine. To test it
you need to add it to cocoon.

Added: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/contract.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/contract.xsl	Fri Nov  5 04:56:33
2004
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  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">
+  <xsl:import href="fct-bits/fct-bits.xsl"/>
+  <xsl:param name="contextPath"/>
+  
+  <!--+
+  |Overall site template
+  +-->
+  <xsl:template match="/">
+    <elements>
+    <xsl:comment>context: <xsl:value-of select="$contextPath"/></xsl:comment>
+<!--+
+  |XHTML-head
+  +-->
+        <head>
+            <xsl:apply-templates select="contract" mode="xhtml-head"/>
+        </head>
+<!--+
+  |XHTML-body
+  +-->
+      <body>
+        <xsl:apply-templates select="contract" mode="xhtml-body"/>
+      </body>
+    </elements>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/dir2contracts.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/dir2contracts.xsl	Fri Nov  5 04:56:33
2004
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xmlns:dir="http://apache.org/cocoon/directory/2.0"
+    xmlns:session="http://apache.org/cocoon/session/1.0"
+    >
+
+<xsl:param name="contentDir" select="'default/path'"/>
+
+  <!--
+      Create row for each document.  Information about the document is
+      extracted from the document itself using the document()
+      function.
+  -->
+  <xsl:template match="/">
+      <contracts xmlns:xhtml="http://www.w3.org/1999/xhtml">
+        <xsl:apply-templates select="//dir:file"/>                    
+      </contracts>
+  </xsl:template>
+
+<xsl:template match="dir:file[starts-with(@name,'c-')]">
+    <xsl:variable name="fct-bit-file">
+      <xsl:value-of select="$contentDir"/>
+      <xsl:text>/</xsl:text>
+      <xsl:value-of select="@name"/>
+    </xsl:variable>
+    <xsl:variable name="fct-bit-title">
+      <xsl:value-of select="document($fct-bit-file)/contract/@name"/>
+    </xsl:variable>
+    <xsl:variable name="fct-bit-nc">
+      <xsl:value-of select="document($fct-bit-file)/contract/@nc"/>
+    </xsl:variable>
+    <xsl:variable name="fct-bit-tlc">
+      <xsl:value-of select="document($fct-bit-file)/contract/@tlc"/>
+    </xsl:variable>
+    <xsl:variable name="fct-bit-description">
+      <xsl:value-of select="document($fct-bit-file)/contract/description"/>
+    </xsl:variable>
+    <xsl:if test="$fct-bit-tlc='content'">
+      <content>
+        <contract name="{$fct-bit-title}">
+          <css-contract>
+            <xsl:value-of select="$fct-bit-nc"/>
+          </css-contract>
+          <description>
+            <xsl:value-of select="$fct-bit-description"/>
+          </description>
+          <realpath>
+            <xsl:value-of select="$fct-bit-file"/>
+          </realpath>
+        </contract>
+      </content>
+    </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+

Modified: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/c-fontsize-fct.xml
==============================================================================
--- forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/c-fontsize-fct.xml	(original)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/c-fontsize-fct.xml	Fri Nov
 5 04:56:33 2004
@@ -1,22 +1,21 @@
 <?xml version="1.0"?>
-<!-- NOTE this should better be a xslt -->
-<contract name="fontsize-fct">
+<contract name="fontsize-fct" nc="fontsize" tlc="content">
   <description>
     This functions lets you change the size of the font you are using in the site with a
jscript.
   </description>
-  <head>
-    <!-- fontsize - needed if fontsize script should be in  -->
-    <script type="text/javascript" language="javascript" 
-      src="{$root}skin/fontsize.js"></script>
-  </head>
-  <body onload="init()">
-    <!-- fontsize - needed if fontsize script should be in  -->
-    <script type="text/javascript">ndeSetTextSize();</script>
-	  <div class="trail">
-	        Font size: 
-	          &#160;<input type="button" onclick="ndeSetTextSize('reset'); return false;"
title="Reset text" class="resetfont" value="Reset"/>      
-	          &#160;<input type="button" onclick="ndeSetTextSize('decr'); return false;"
title="Shrink text" class="smallerfont" value="-a"/>
-	          &#160;<input type="button" onclick="ndeSetTextSize('incr'); return false;"
title="Enlarge text" class="biggerfont" value="+a"/>
-    </div>
-  </body>
+  <xhtml>
+    <head>
+      <script type="text/javascript" language="javascript" 
+        src="{$root}skin/fontsize.js"></script>
+    </head>
+    <body onload="init()">
+      <script type="text/javascript">ndeSetTextSize();</script>
+      <div class="trail">
+            Font size: 
+              &#160;<input type="button" onclick="ndeSetTextSize('reset'); return
false;" title="Reset text" class="resetfont" value="Reset"/>      
+              &#160;<input type="button" onclick="ndeSetTextSize('decr'); return false;"
title="Shrink text" class="smallerfont" value="-a"/>
+              &#160;<input type="button" onclick="ndeSetTextSize('incr'); return false;"
title="Enlarge text" class="biggerfont" value="+a"/>
+      </div>
+    </body>
+  </xhtml>
 </contract>

Modified: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.txt
==============================================================================
--- forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.txt	(original)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.txt	Fri Nov  5
04:56:33 2004
@@ -1,7 +1,7 @@
 function-bits or short fct-bits are capsulated functions that can be used in the site.
 
 A fct-bit contains following parts:
-<contract name="{name-of-the-function}-fct" nc="{css-contract}">
+<contract name="{name-of-the-function}-fct" nc="{css-contract}" tlc="{topLevelContainer}">
   <description>
     This functions ...
   </description>
@@ -12,7 +12,7 @@
     </head>
     <body onload="init()">
       <script type="text/javascript">something();</script>
-      <div class="{contract-name}">
+      <div id="{css-contract-name}">
             CONTENT
       </div>
     </body>
@@ -22,8 +22,10 @@
 
 @name = name of the function contract
 @nc = name of the css-contract
+@tlc = the top level container to which this function semanticly belongs
 <xhtml/> = this code will be used in xhtml
 <pdf/> = this code will be used in pdf
 <head/> = if functions need to place code into the xhtml-head it has to go into this
container
 <body/> = if functions need to place code into the xhtml-body it has to go into this
container
 <script/> = the script, that has to be placed into 
+<div> = the actual div that should be used in the code

Added: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/fct-bits.xsl	Fri Nov  5
04:56:33 2004
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="contract" mode="xhtml-head">
+  <xsl:comment>function name=<xsl:value-of select="@name"/> HEAD</xsl:comment>
+  <xsl:copy-of select="xhtml/head/*"/>
+</xsl:template>
+
+<xsl:template match="contract" mode="xhtml-body">
+  <xsl:comment>function name=<xsl:value-of select="@name"/> BODY</xsl:comment>
+  <xsl:copy-of select="xhtml/body/*"/>
+</xsl:template>
+</xsl:stylesheet>

Added: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/pipeline.txt
==============================================================================
--- (empty file)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/fct-bits/pipeline.txt	Fri Nov  5
04:56:33 2004
@@ -0,0 +1,6 @@
+the pipeline to include the fct-bits into the outcome should be like this:
+
+skinconf.xml + site2xml.xsl = container.xsl
+ft.xml + container.xsl = XHTML output
+
+the site2xml has to include the fct-bits into the container.

Added: forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/sitemap.xmap
==============================================================================
--- (empty file)
+++ forrest/trunk/main/webapp/skins/leather-dev/xslt/xml/sitemap.xmap	Fri Nov  5 04:56:33
2004
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  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.
+-->
+
+<!-- CVS $Id: sitemap.xmap,v 1.26 2004/05/19 11:32:02 cziegeler Exp $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components ================================ -->
+
+ <map:components>
+  <map:generators default="file">
+   <map:generator name="linkstatus" src="org.apache.cocoon.generation.LinkStatusGenerator"/>
+   <map:generator name="calendar" src="org.apache.cocoon.generation.CalendarGenerator"/>
+  </map:generators>
+  <map:transformers default="xslt"/>
+  <map:readers default="resource"/>
+  <map:serializers default="html"/>
+  <map:matchers default="wildcard"/>
+  <map:selectors default="browser"/>
+ </map:components>
+
+<!-- =========================== Views =================================== -->
+
+ <map:views>
+  <map:view name="content" from-label="content">
+   <map:serialize type="xml"/>
+  </map:view>
+
+  <map:view from-label="content" name="pretty-content">
+    <map:transform src="context://stylesheets/system/xml2html.xslt"/>
+    <map:serialize type="html"/>
+  </map:view>
+
+  <map:view name="links" from-position="last">
+   <map:serialize type="links"/>
+  </map:view>
+ </map:views>
+
+<!-- =========================== Pipelines ================================= -->
+
+ <map:pipelines>
+  <map:pipeline>
+
+   <map:match pattern="">
+     <map:generate src="fct-bits/c-fontsize-fct.xml"/>
+     <map:transform src="contract.xsl">
+        <map:parameter name="contextPath" value="{request:contextPath}"/>
+     </map:transform>
+     <map:serialize type="xml"/>
+   </map:match>
+
+   <!-- ======================== Automount =============================== -->
+
+   <map:match pattern="*/**">
+     <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/>
+   </map:match>
+
+  </map:pipeline>
+  
+  <map:pipeline>
+    <map:match pattern="contracts.xml">
+		  <map:generate type="directory" src="fct-bits">
+        <map:parameter name="depth" value="1"/>
+        <!-- sorted alphabetically -->
+      	<map:parameter name="reverse" value="false"/>
+      </map:generate>
+      <map:transform src="dir2contracts.xsl">
+        <map:parameter name="contentDir" value="{realpath:leather/fct-bits}"/>
+      </map:transform>
+      <map:serialize type="xml"/>
+    </map:match>
+  </map:pipeline>
+
+ </map:pipelines>
+</map:sitemap>

Mime
View raw message