svn commit: r618205 - in /lenya/trunk/src/modules: collection/ collection/xslt/ news/ news/xslt/

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Mon Feb  4 00:51:46 2008
New Revision: 618205

URL: http://svn.apache.org/viewvc?rev=618205&view=rev
Log:
Switch to explicit lenya-document:/ syntax in collection and news modules, replaced cinclude transformation by include transformation.

Added:
    lenya/trunk/src/modules/collection/xslt/collection2include.xsl
    lenya/trunk/src/modules/collection/xslt/prepareInclude.xsl
Removed:
    lenya/trunk/src/modules/collection/xslt/collection2cinclude.xsl
    lenya/trunk/src/modules/collection/xslt/prepareCinclude.xsl
Modified:
    lenya/trunk/src/modules/collection/sitemap.xmap
    lenya/trunk/src/modules/news/sitemap.xmap
    lenya/trunk/src/modules/news/xslt/collection2header.xsl
    lenya/trunk/src/modules/news/xslt/collection2include.xsl
    lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl
    lenya/trunk/src/modules/news/xslt/shared.xsl

Modified: lenya/trunk/src/modules/collection/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/sitemap.xmap?rev=618205&r1=618204&r2=618205&view=diff
==============================================================================
--- lenya/trunk/src/modules/collection/sitemap.xmap (original)
+++ lenya/trunk/src/modules/collection/sitemap.xmap Mon Feb  4 00:51:46 2008
@@ -24,18 +24,14 @@
 
     <map:pipeline>
       
-      <map:match pattern="collectionWithChildren/*/*/*.xml">
-        <map:generate src="cocoon:/collectionWithChildren/{1}/{page-envelope:publication-id}/{page-envelope:area}/{2}/{3}.xml"/>
-        <map:serialize type="xml"/>
-      </map:match>
-      
       <!-- collectionWithChildren/{1:allLanguages(true|false)}/{2:pub}/{3:area}/{4:uuid}/{5:language}.xml -->
       <map:match pattern="collectionWithChildren/*/*/*/*/*.xml">
         <map:generate type="sitetree-fragment">
           <map:parameter name="pub" value="{2}"/>
           <map:parameter name="areas" value="{3}"/>
           <map:parameter name="area" value="{3}"/>
-          <map:parameter name="path" value="{doc-info:{2}:{3}:{4}:{5}:path}"/>
+          <map:parameter name="uuid" value="{4}"/>
+          <map:parameter name="language" value="{5}"/>
           <map:parameter name="initial" value="false"/>
           <map:parameter name="mimetype" value=""/>
         </map:generate>
@@ -47,20 +43,22 @@
         <map:serialize type="xml"/>
       </map:match>
       
-      <!-- metadata/{uuid}/{language}.xml -->
-      <map:match pattern="metadata/*/*.xml">
-        <map:generate type="lenyaMetaData" src="lenya-document:{1},lang={2}"/>
+      <!-- metadata/{1:pub}/{2:area}{3:uuid}/{4:language}.xml -->
+      <map:match pattern="metadata/*/*/*/*.xml">
+        <map:generate type="lenyaMetaData" src="lenya-document:{3},pub={1},area={2},lang={4}"/>
         <map:serialize type="xml"/>
       </map:match>
       
       <!-- collection format -->
       <map:match pattern="collection.xml/*/*/*/*">
         <map:generate src="lenya-document:{3},pub={1},area={2},lang={4}{link:rev}"/>
-        <map:transform src="fallback://lenya/modules/collection/xslt/prepareCinclude.xsl">
+        <map:transform src="fallback://lenya/modules/collection/xslt/prepareInclude.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:transform>
-        <map:transform type="cinclude"/>
+        <map:transform type="include"/>
         <map:serialize type="xml"/>
       </map:match>        
       

Added: lenya/trunk/src/modules/collection/xslt/collection2include.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/xslt/collection2include.xsl?rev=618205&view=auto
==============================================================================
--- lenya/trunk/src/modules/collection/xslt/collection2include.xsl (added)
+++ lenya/trunk/src/modules/collection/xslt/collection2include.xsl Mon Feb  4 00:51:46 2008
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:ci="http://apache.org/cocoon/include/1.0">
+  
+  
+  <xsl:param name="pub"/>
+  <xsl:param name="area"/>
+  <xsl:param name="uuid"/>
+  <xsl:param name="language"/>
+  
+  
+  <xsl:template match="/col:collection">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <ci:include src="cocoon://modules/collection/metadata/{$pub}/{$area}/{$uuid}/{$language}.xml"/>
+      <xsl:apply-templates select="*"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="*/col:collection">
+    <xsl:apply-templates select="*"/>
+  </xsl:template>
+  
+  
+  <xsl:template match="col:document">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:if test="not(*)">
+        <ci:include src="cocoon://modules/collection/metadata/{$pub}/{$area}/{@uuid}/{@xml:lang}.xml"/>
+        <ci:include src="lenya-document:{@uuid},pub={$pub},area={$area},lang={@xml:lang}?format=xhtml"/>
+      </xsl:if>
+      <xsl:copy-of select="*"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
\ No newline at end of file

Added: lenya/trunk/src/modules/collection/xslt/prepareInclude.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/collection/xslt/prepareInclude.xsl?rev=618205&view=auto
==============================================================================
--- lenya/trunk/src/modules/collection/xslt/prepareInclude.xsl (added)
+++ lenya/trunk/src/modules/collection/xslt/prepareInclude.xsl Mon Feb  4 00:51:46 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:i="http://apache.org/cocoon/include/1.0">
+  
+  <xsl:param name="pub"/>
+  <xsl:param name="area"/>
+  <xsl:param name="uuid"/>
+  <xsl:param name="language"/>
+  
+  <xsl:template match="col:collection">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:choose>
+        <xsl:when test="@type = 'children'">
+          <xsl:variable name="allLanguages">
+            <xsl:choose>
+              <xsl:when test="@allLanguages"><xsl:value-of select="@allLanguages"/></xsl:when>
+              <xsl:otherwise>false</xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+          <i:include src="cocoon://modules/collection/collectionWithChildren/{$allLanguages}/{$pub}/{$area}/{$uuid}/{$language}.xml" select="*/*"/>
+        </xsl:when>
+        <xsl:when test="@type = 'link'">
+          <i:include src="{@href}" select="*/*"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:copy-of select="col:document"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+</xsl:stylesheet>
\ No newline at end of file

Modified: lenya/trunk/src/modules/news/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/sitemap.xmap?rev=618205&r1=618204&r2=618205&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/sitemap.xmap (original)
+++ lenya/trunk/src/modules/news/sitemap.xmap Mon Feb  4 00:51:46 2008
@@ -50,26 +50,31 @@
         
         <!-- This is a workaround (see below). -->
         <map:generate src="lenya-document:{4},pub={2},area={3},lang={5}{link:rev}"/>
-        <map:transform src="fallback://lenya/modules/collection/xslt/prepareCinclude.xsl">
+        <map:transform src="fallback://lenya/modules/collection/xslt/prepareInclude.xsl">
+          <map:parameter name="pub" value="{2}"/>
+          <map:parameter name="area" value="{3}"/>
           <map:parameter name="uuid" value="{4}"/>
           <map:parameter name="language" value="{5}"/>
         </map:transform>
-        <map:transform type="cinclude"/>
+        <map:transform type="include"/>
         
         <!-- This would be a nicer way, but causes NPES in AbstractEnvironment.release(AbstractEnvironment.java:561)
         <map:generate src="{resource-type:collection:format-collection}/{2}/{3}/{4}/{5}"/>
         -->
         
-        <map:transform src="fallback://lenya/modules/collection/xslt/collection2cinclude.xsl">
+        <map:transform src="fallback://lenya/modules/collection/xslt/collection2include.xsl">
+          <map:parameter name="pub" value="{2}"/>
+          <map:parameter name="area" value="{3}"/>
           <map:parameter name="uuid" value="{4}"/>
           <map:parameter name="language" value="{5}"/>
         </map:transform>
-        <map:transform type="cinclude"/>
+        <map:transform type="include"/>
         <map:transform src="fallback://lenya/modules/news/xslt/collection2{1}.xsl">
-          <map:parameter name="language" value="{5}"/>
           <map:parameter name="title" value=""/>
+          <map:parameter name="pub" value="{2}"/>
           <map:parameter name="area" value="{3}"/>
           <map:parameter name="uuid" value="{4}"/>
+          <map:parameter name="language" value="{5}"/>
           <map:parameter name="baseUrl" value="/{2}/{3}"/>
         </map:transform>
         <map:match pattern="rss.xml/**">

Modified: lenya/trunk/src/modules/news/xslt/collection2header.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/collection2header.xsl?rev=618205&r1=618204&r2=618205&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2header.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2header.xsl Mon Feb  4 00:51:46 2008
@@ -30,11 +30,14 @@
     exclude-result-prefixes="xhtml lenya col meta dc i18n"
     >
     
+  <xsl:param name="pub"/>
+  <xsl:param name="area"/>
   <xsl:param name="uuid"/>
+  <xsl:param name="language"/>
   
   <xsl:template match="/col:collection">
     <link rel="alternate" type="application/rss+xml"
-      title="RSS" href="lenya-document:{$uuid}?uuid2url.extension=rss" />
+      title="RSS" href="lenya-document:{$uuid},pub={$pub},area={$area},lang={$language}?uuid2url.extension=rss" />
   </xsl:template>
 
 </xsl:stylesheet> 

Modified: lenya/trunk/src/modules/news/xslt/collection2include.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/collection2include.xsl?rev=618205&r1=618204&r2=618205&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2include.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2include.xsl Mon Feb  4 00:51:46 2008
@@ -33,6 +33,8 @@
   <xsl:import href="fallback://lenya/modules/news/xslt/collection2xhtml.xsl"/>
   
   <xsl:param name="nodeid"/>
+  <xsl:param name="pub"/>
+  <xsl:param name="area"/>
   <xsl:param name="language"/>
   <xsl:param name="uuid"/>
   
@@ -42,7 +44,7 @@
     <xsl:variable name="title" select="meta:metadata/dc:elements/dc:title"/>
     <div id="news">
       <div class="rsslink">
-        <a type="application/rss+xml" href="lenya-document:{$uuid}?uuid2url.extension=rss">RSS 2.0</a>
+        <a type="application/rss+xml" href="lenya-document:{$uuid},pub={$pub},area={$area},lang={$language}?uuid2url.extension=rss">RSS 2.0</a>
       </div>
       <h1><xsl:value-of select="$title"/></h1>
       <xsl:choose>

Modified: lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl?rev=618205&r1=618204&r2=618205&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl Mon Feb  4 00:51:46 2008
@@ -35,6 +35,7 @@
   
   <xsl:param name="nodeid"/>
   <xsl:param name="language"/>
+  <xsl:param name="pub"/>
   <xsl:param name="area"/>
   
   <xsl:variable name="maxChars">100</xsl:variable>

Modified: lenya/trunk/src/modules/news/xslt/shared.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/shared.xsl?rev=618205&r1=618204&r2=618205&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/shared.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/shared.xsl Mon Feb  4 00:51:46 2008
@@ -1,9 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   
+  <xsl:param name="pub"/>
+  <xsl:param name="area"/>
+  
   <xsl:template name="getHref">
     <xsl:choose>
-      <xsl:when test="@uuid">lenya-document:<xsl:value-of select="@uuid"/>,lang=<xsl:value-of select="@xml:lang"/></xsl:when>
+      <xsl:when test="@uuid">lenya-document:<xsl:value-of select="@uuid"/>,pub=<xsl:value-of select="$pub"/>,area=<xsl:value-of select="$area"/>,lang=<xsl:value-of select="@xml:lang"/></xsl:when>
       <xsl:when test="@href"><xsl:value-of select="@href"/></xsl:when>
     </xsl:choose>
   </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.