svn commit: r634344 - in /lenya/sandbox/modules/docustyle: sitemap.xmap xslt/afterCache.xsl xslt/beforeCache.xsl

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Mar  6 09:04:55 2008
New Revision: 634344

URL: http://svn.apache.org/viewvc?rev=634344&view=rev
Log:
Simplifying docu pipelines and XLST (no caching means an XSLT transformation is obsolete).

Modified:
    lenya/sandbox/modules/docustyle/sitemap.xmap
    lenya/sandbox/modules/docustyle/xslt/afterCache.xsl
    lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl

Modified: lenya/sandbox/modules/docustyle/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/sitemap.xmap?rev=634344&r1=634343&r2=634344&view=diff
==============================================================================
--- lenya/sandbox/modules/docustyle/sitemap.xmap (original)
+++ lenya/sandbox/modules/docustyle/sitemap.xmap Thu Mar  6 09:04:55 2008
@@ -76,24 +76,8 @@
       
     </map:pipeline>
     
-    <map:pipeline type="noncaching">
-      <!-- {1:pub}/{2:area}/{3:uuid}/{4:defaultLang}/{5:lang}/{6:path} -->
-      <map:match pattern="pageContext/*/*/*/*/*/**">
-        <map:generate src="fallback://lenya/content/util/empty.xml"/>
-        <map:transform src="fallback://lenya/modules/docustyle/xslt/beforeCache.xsl">
-          <map:parameter name="pub" value="{1}"/>
-          <map:parameter name="area" value="{2}"/>
-          <map:parameter name="uuid" value="{3}"/>
-          <map:parameter name="language" value="{5}"/>
-          <map:parameter name="path" value="{6}"/>
-        </map:transform>
-        <map:transform type="include"/>
-        <map:serialize type="xml"/>
-      </map:match>
-    </map:pipeline>
     
-    
-    <!-- This is the pipeline that ultimately builds the page. -->
+    <!-- Pipeliens for navigation elements.. -->
     <map:pipeline type="noncaching">
       
       <map:match pattern="menu/*">
@@ -121,23 +105,26 @@
         <map:serialize/>
       </map:match>
       
+    </map:pipeline>
       
-      <!-- 
-        This matcher takes the raw aggregated page content and applies SVG rendering and a doctype-specific
-        XSL transformation. It makes some meta information available to the XSLT, and demonstrates the use
-        of the LenyaMetaDataTransformer (see below).
-        /page/{1:publication-id}/{2:area}/{3:uuid}/{4:language}
-      -->
+    <!-- This is the pipeline that ultimately builds the page. -->
+    <map:pipeline type="noncaching">
+      
+      <!-- /page/{1:publication-id}/{2:area}/{3:uuid}/{4:language} -->
       <map:match pattern="page/*/*/*/*">
-        <map:generate src="cocoon:/pageContext/{1}/{2}/{3}/{page-envelope:default-language}/{4}{page-envelope:document-path}"/>
-        <map:transform src="fallback://lenya/modules/docustyle/xslt/afterCache.xsl">
+        
+        <map:generate src="fallback://lenya/content/util/empty.xml"/>
+        
+        <map:transform src="fallback://lenya/modules/docustyle/xslt/beforeCache.xsl">
           <map:parameter name="pub" value="{1}"/>
           <map:parameter name="area" value="{2}"/>
           <map:parameter name="uuid" value="{3}"/>
           <map:parameter name="language" value="{4}"/>
+          <map:parameter name="path" value="{page-envelope:document-path}"/>
           <map:parameter name="lastPublishedUser" value="{access-control:user-name:{workflow:lastUser.publish}}"/>
           <map:parameter name="lastPublishedDate" value="{workflow:lastDate.publish}"/>
         </map:transform>
+        
         <map:transform type="include"/>
         <map:transform type="externallinks-xhtml"/>
         <map:transform src="fallback://lenya/modules/svg/xslt/image2svg.xsl"/>

Modified: lenya/sandbox/modules/docustyle/xslt/afterCache.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/xslt/afterCache.xsl?rev=634344&r1=634343&r2=634344&view=diff
==============================================================================
--- lenya/sandbox/modules/docustyle/xslt/afterCache.xsl (original)
+++ lenya/sandbox/modules/docustyle/xslt/afterCache.xsl Thu Mar  6 09:04:55 2008
@@ -33,58 +33,9 @@
   <xsl:param name="uuid"/>
   <xsl:param name="language"/>
   
-  <xsl:param name="lastPublishedUser"/>
-  <xsl:param name="lastPublishedDate"/>
-  
-  
-  <xsl:template match="xhtml:div[@id = 'breadcrumb']">
-    <xsl:if test="*">
-      <xsl:copy>
-        <xsl:apply-templates select="@*|node()"/>
-      </xsl:copy>
-    </xsl:if>
-  </xsl:template>
-  
-  
-  <xsl:template match="xhtml:div[@id = 'body']">
-    <div id="body">
-      <i:include src="lenya-document:{$uuid},pub={$pub},area={$area},lang={$language}?format=xhtml" strip-root="true">
-        <i:fallback>
-          <p>
-            This document doesn't exist.
-          </p>
-        </i:fallback>
-      </i:include>
-      <xsl:call-template name="footer"/>
-    </div>
-  </xsl:template>
   
   
   <xsl:template match="xhtml:ul[@id = 'menu' and not(*)]"/>
-  
-  
-  <xsl:template name="footer">
-    <div id="footer">
-      <p>
-        Copyright &#169; 1999-2007 <a href="http://www.apache.org/">The Apache
-          Software Foundation</a>. All rights reserved.
-      </p>
-      <p>
-        <xsl:choose>
-          <xsl:when test="$lastPublishedUser != ''">
-            <i18n:translate>
-              <i18n:text>last-published</i18n:text>
-              <i18n:param><i18n:date-time src-pattern="yyyy-MM-dd HH:mm:ss"><xsl:value-of select="$lastPublishedDate"/></i18n:date-time></i18n:param>
-              <i18n:param><xsl:value-of select="$lastPublishedUser"/></i18n:param>
-            </i18n:translate>
-          </xsl:when>
-          <xsl:otherwise>
-            <i18n:text>never-published</i18n:text>
-          </xsl:otherwise>
-        </xsl:choose>
-      </p>
-    </div>
-  </xsl:template>
   
   
   <xsl:template match="@*|node()" priority="-1">

Modified: lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl?rev=634344&r1=634343&r2=634344&view=diff
==============================================================================
--- lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl (original)
+++ lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl Thu Mar  6 09:04:55 2008
@@ -37,6 +37,11 @@
   <xsl:param name="language"/>
   <xsl:param name="path"/>
   
+  <xsl:param name="lastPublishedUser"/>
+  <xsl:param name="lastPublishedDate"/>
+  
+  <xsl:variable name="pathAfterSlash" select="substring($path, 2)"/>
+  
   <xsl:template match="/*">
     <html>
       <head>
@@ -73,22 +78,31 @@
                 <a href="/{$pub}/{$area}/"><img src="/{$pub}/{$area}/docustyle/images/project-logo-small.png" alt="project logo"/></a>
               </div>
             </div>
-            <!--
-            <lenya:navElement name="tabs"/>
-            -->
             <i:include src="cocoon:/tabs"/>
             <div id="tabsSeparator"/>
           </div>
           
           <div id="main">
+            
             <xsl:variable name="firstPathStep">
               <xsl:choose>
-                <xsl:when test="contains($path, '/')"><xsl:value-of select="substring-before($path, '/')"/></xsl:when>
-                <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+                <xsl:when test="contains($pathAfterSlash, '/')"><xsl:value-of select="substring-before($pathAfterSlash, '/')"/></xsl:when>
+                <xsl:otherwise><xsl:value-of select="$pathAfterSlash"/></xsl:otherwise>
               </xsl:choose>
             </xsl:variable>
             <i:include src="cocoon:/menu/{$firstPathStep}"/>
-            <div id="body"/>
+            
+            <div id="body">
+              <i:include src="lenya-document:{$uuid},pub={$pub},area={$area},lang={$language}?format=xhtml" strip-root="true">
+                <i:fallback>
+                  <p>
+                    This document doesn't exist.
+                  </p>
+                </i:fallback>
+              </i:include>
+              <xsl:call-template name="footer"/>
+            </div>
+            
           </div>
         </div>
       </body>
@@ -106,6 +120,30 @@
           <input class="searchsubmit" type="image" src="/{$pub}/{$area}/docustyle/images/search.png"/>
         </p>
       </form>
+    </div>
+  </xsl:template>
+  
+  
+  <xsl:template name="footer">
+    <div id="footer">
+      <p>
+        Copyright &#169; 1999-2007 <a href="http://www.apache.org/">The Apache
+          Software Foundation</a>. All rights reserved.
+      </p>
+      <p>
+        <xsl:choose>
+          <xsl:when test="$lastPublishedUser != ''">
+            <i18n:translate>
+              <i18n:text>last-published</i18n:text>
+              <i18n:param><i18n:date-time src-pattern="yyyy-MM-dd HH:mm:ss"><xsl:value-of select="$lastPublishedDate"/></i18n:date-time></i18n:param>
+              <i18n:param><xsl:value-of select="$lastPublishedUser"/></i18n:param>
+            </i18n:translate>
+          </xsl:when>
+          <xsl:otherwise>
+            <i18n:text>never-published</i18n:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </p>
     </div>
   </xsl:template>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.