You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/03/30 00:59:02 UTC

svn commit: r642648 - in /lenya/trunk/src/modules/news: ./ config/cocoon-xconf/ xslt/

Author: andreas
Date: Sat Mar 29 16:59:00 2008
New Revision: 642648

URL: http://svn.apache.org/viewvc?rev=642648&view=rev
Log:
Fix recursive news inclusion and RSS generation.

Added:
    lenya/trunk/src/modules/news/xslt/addDate.xsl
    lenya/trunk/src/modules/news/xslt/addResourceType.xsl
    lenya/trunk/src/modules/news/xslt/flatten.xsl
    lenya/trunk/src/modules/news/xslt/includeSubNews.xsl
    lenya/trunk/src/modules/news/xslt/sort.xsl
Modified:
    lenya/trunk/src/modules/news/config/cocoon-xconf/resourcetype-news.xconf
    lenya/trunk/src/modules/news/sitemap.xmap
    lenya/trunk/src/modules/news/xslt/collection2include.xsl
    lenya/trunk/src/modules/news/xslt/collection2rss.xsl
    lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl

Modified: lenya/trunk/src/modules/news/config/cocoon-xconf/resourcetype-news.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/config/cocoon-xconf/resourcetype-news.xconf?rev=642648&r1=642647&r2=642648&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/config/cocoon-xconf/resourcetype-news.xconf (original)
+++ lenya/trunk/src/modules/news/config/cocoon-xconf/resourcetype-news.xconf Sat Mar 29 16:59:00 2008
@@ -37,6 +37,7 @@
     <format name="xhtml" uri="cocoon://modules/news/xhtml.xml"/>
     <format name="include" uri="cocoon://modules/news/include.xml"/>
     <format name="rss" uri="cocoon://modules/news/rss.xml"/>
+    <format name="rssItem" uri="cocoon://modules/news/rssItem.xml"/>
     <format name="header" uri="cocoon://modules/news/header.xml"/>
     
   </component-instance>

Modified: lenya/trunk/src/modules/news/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/sitemap.xmap?rev=642648&r1=642647&r2=642648&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/sitemap.xmap (original)
+++ lenya/trunk/src/modules/news/sitemap.xmap Sat Mar 29 16:59:00 2008
@@ -36,7 +36,7 @@
 
   <map:pipelines>
 
-    <map:pipeline>
+    <map:pipeline type="noncaching">
 
       <!-- parametrized doctype matcher -->
       <!-- pattern="{format}.xml" -->
@@ -45,30 +45,56 @@
         <map:serialize type="xml"/>
       </map:match>
       
-      <!-- pattern="{format}.xml/{pubId}/{area}/{uuid}/{language}" -->
-      <map:match pattern="*.xml/*/*/*/*">
-        
-        <!-- This is a workaround (see below). -->
-        <map:generate src="lenya-document:{4},pub={2},area={3},lang={5}{link:rev}"/>
+      
+      <!-- feedContent/news/{1:format}/{2:pub}/{3:area}/{4:uuid}/{5:language} -->
+      <map:match pattern="feedContent/news/*/*/*/*/*">
+        <map:generate src="lenya-document:{4},pub={2},area={3},lang={5}"/>
         <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:parameter name="format" value="{1}"/>
         </map:transform>
         <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/collection2include.xsl">
+        <map:transform src="fallback://lenya/modules/news/xslt/addResourceType.xsl"/>
+        <map:transform type="metaData">
+          <map:parameter name="pubid" value="{2}"/>
+          <map:parameter name="area" value="{3}"/>
+        </map:transform>
+        <map:transform src="fallback://lenya/modules/news/xslt/includeSubNews.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:parameter name="format" value="{1}"/>
         </map:transform>
         <map:transform type="include"/>
+        <map:transform src="fallback://lenya/modules/news/xslt/flatten.xsl"/>
+        <map:transform src="fallback://lenya/modules/news/xslt/sort.xsl"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      
+      <!-- feedContent/{1:resourceType}/{2:format}/{3:pub}/{4:area}/{5:uuid}/{6:language} -->
+      <map:match pattern="feedContent/*/*/*/*/*/*">
+        <map:aggregate element="document" ns="http://apache.org/cocoon/lenya/collection/1.0">
+          <map:part src="lenya-document:{5},pub={3},area={4},lang={6}?format=xhtml"/>
+        </map:aggregate>
+        <map:transform src="fallback://lenya/modules/news/xslt/addDate.xsl">
+          <map:parameter name="uuid" value="{5}"/>
+          <map:parameter name="language" value="{6}"/>
+        </map:transform>
+        <map:transform type="metaData">
+          <map:parameter name="pubid" value="{3}"/>
+          <map:parameter name="area" value="{4}"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      
+      <!-- pattern="{format}.xml/{pubId}/{area}/{uuid}/{language}" -->
+      <map:match pattern="*.xml/*/*/*/*">
+        
+        <map:generate src="cocoon:/feedContent/news/{1}/{2}/{3}/{4}/{5}"/>
         <map:transform src="fallback://lenya/modules/news/xslt/collection2{1}.xsl">
           <map:parameter name="title" value=""/>
           <map:parameter name="pub" value="{2}"/>
@@ -77,14 +103,20 @@
           <map:parameter name="language" value="{5}"/>
           <map:parameter name="baseUrl" value="/{2}/{3}"/>
         </map:transform>
+        <map:transform type="metaData">
+          <map:parameter name="pubid" value="{2}"/>
+          <map:parameter name="area" value="{3}"/>
+        </map:transform>
         <map:match pattern="rss.xml/**">
           <map:transform type="uuid2url"/>
-          <map:transform type="proxy"/>
-          <map:transform src="xslt/rss/xhtmllink2rsslink.xsl"/>
-          <map:transform type="i18n">
-            <map:parameter name="locale" value="{5}"/>
+          <map:transform type="proxy">
+            <map:parameter name="urls" value="absolute"/>
           </map:transform>
+          <map:transform src="xslt/rss/xhtmllink2rsslink.xsl"/>
         </map:match>
+        <map:transform type="i18n">
+          <map:parameter name="locale" value="{5}"/>
+        </map:transform>
         <map:serialize type="xml"/>
       </map:match>
 

Added: lenya/trunk/src/modules/news/xslt/addDate.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/addDate.xsl?rev=642648&view=auto
==============================================================================
--- lenya/trunk/src/modules/news/xslt/addDate.xsl (added)
+++ lenya/trunk/src/modules/news/xslt/addDate.xsl Sat Mar 29 16:59:00 2008
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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:col="http://apache.org/cocoon/lenya/collection/1.0"
+    xmlns:meta="http://apache.org/lenya/meta/1.0/"
+    xmlns:doc="http://apache.org/lenya/metadata/document/1.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    >
+  
+  <xsl:param name="uuid"/>
+  <xsl:param name="language"/>
+  
+  
+  <xsl:template match="col:document">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <dc:date><meta:value element="date" ns="http://purl.org/dc/elements/1.1/"
+        uuid="{$uuid}" lang="{$language}"/></dc:date>
+      <xsl:apply-templates select="node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+
+</xsl:stylesheet> 

Added: lenya/trunk/src/modules/news/xslt/addResourceType.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/addResourceType.xsl?rev=642648&view=auto
==============================================================================
--- lenya/trunk/src/modules/news/xslt/addResourceType.xsl (added)
+++ lenya/trunk/src/modules/news/xslt/addResourceType.xsl Sat Mar 29 16:59:00 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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:col="http://apache.org/cocoon/lenya/collection/1.0"
+    xmlns:meta="http://apache.org/lenya/meta/1.0/"
+    xmlns:doc="http://apache.org/lenya/metadata/document/1.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    >
+
+      
+  <xsl:template match="*/col:collection">
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+  
+  <xsl:template match="col:document">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:if test="@uuid">
+        <doc:resourceType><meta:value element="resourceType" ns="http://apache.org/lenya/metadata/document/1.0"
+          uuid="{@uuid}" lang="{@xml:lang}"/></doc:resourceType>
+      </xsl:if>
+      <xsl:apply-templates select="node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </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=642648&r1=642647&r2=642648&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2include.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2include.xsl Sat Mar 29 16:59:00 2008
@@ -6,9 +6,9 @@
   The ASF licenses this file to You 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
-
+  
+  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.
@@ -19,17 +19,14 @@
 <!-- $Id: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
 
 <xsl:stylesheet version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:xhtml="http://www.w3.org/1999/xhtml"
-    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
-    xmlns="http://www.w3.org/1999/xhtml"
-    xmlns:dc="http://purl.org/dc/elements/1.1/"
-    xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
-    xmlns:meta="http://apache.org/cocoon/lenya/metadata/1.0"
-    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
-    exclude-result-prefixes="xhtml lenya col meta dc i18n"
-    >
-    
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:meta="http://apache.org/lenya/meta/1.0/"
+  exclude-result-prefixes="xhtml col meta"
+  >
+  
   <xsl:import href="fallback://lenya/modules/news/xslt/collection2xhtml.xsl"/>
   
   <xsl:param name="nodeid"/>
@@ -41,32 +38,16 @@
   <xsl:variable name="includeItems" select="/col:collection/@includeItems"/>
   
   <xsl:template match="/col:collection">
-    <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},pub={$pub},area={$area},lang={$language}?uuid2url.extension=rss">RSS 2.0</a>
-      </div>
-      <h1><xsl:value-of select="$title"/></h1>
-      <xsl:choose>
-        <xsl:when test="col:document//xhtml:div[@class = 'newsItem']">
-          <xsl:for-each select="col:document//xhtml:div[@class = 'newsItem']">
-            <xsl:sort select="xhtml:h2/xhtml:span[@class = 'newsDate']/i18n:date-time/@value" order="descending"/>
-            <xsl:if test="position() &lt;= number($includeItems)">
-              <xsl:apply-templates select="."/>
-            </xsl:if>
-          </xsl:for-each>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:for-each select="col:document">
-            <xsl:sort order="descending" select="meta:metadata/dc:elements/dc:date"/>
-            <xsl:if test="position() &lt;= number($includeItems)">
-              <xsl:apply-templates select="."/>
-            </xsl:if>
-          </xsl:for-each>
-        </xsl:otherwise>
-      </xsl:choose>
+      <h1><meta:value element="title" ns="http://purl.org/dc/elements/1.1/"
+        uuid="{$uuid}" lang="{$language}"/></h1>
+      <xsl:for-each select="col:document">
+        <xsl:if test="position() &lt;= number($includeItems)">
+          <xsl:apply-templates select="."/>
+        </xsl:if>
+      </xsl:for-each>
     </div>
   </xsl:template>
   
-
+  
 </xsl:stylesheet> 

Modified: lenya/trunk/src/modules/news/xslt/collection2rss.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/collection2rss.xsl?rev=642648&r1=642647&r2=642648&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2rss.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2rss.xsl Sat Mar 29 16:59:00 2008
@@ -6,9 +6,9 @@
   The ASF licenses this file to You 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
-
+  
+  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.
@@ -16,19 +16,17 @@
   limitations under the License.
 -->
 
-<!-- $Id: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
-
 <xsl:stylesheet version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:xhtml="http://www.w3.org/1999/xhtml"
-    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
-    xmlns:dc="http://purl.org/dc/elements/1.1/"
-    xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
-    xmlns:meta="http://apache.org/cocoon/lenya/metadata/1.0"
-    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
-    exclude-result-prefixes="xhtml lenya col meta dc i18n"
-    >
-    
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:meta="http://apache.org/lenya/meta/1.0/"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+  exclude-result-prefixes="xhtml lenya col meta dc i18n"
+  >
+  
   <xsl:include href="fallback://lenya/modules/xhtml/xslt/helper-object.xsl"/>
   <xsl:include href="shared.xsl"/>
   
@@ -39,29 +37,29 @@
   
   
   <xsl:template match="/col:collection">
-    <xsl:variable name="title" select="meta:metadata/dc:elements/dc:title"/>
     
     <rss version="2.0">
       
       <channel>
-        <title><xsl:value-of select="$title"/></title>
+        <title><meta:value ns="http://purl.org/dc/elements/1.1/" element="title"
+          uuid="{@uuid}" lang="{$language}"/></title>
         <link><xhtml:a href="{$baseUrl}"/></link>
-        <description></description>
+        <description><meta:value ns="http://purl.org/dc/elements/1.1/" element="description"
+          uuid="{@uuid}" lang="{$language}"/></description>
         <language><xsl:value-of select="$language"/></language>
-        <copyright></copyright>
-        <pubDate><xsl:call-template name="date"/></pubDate>
+        <copyright><meta:value ns="http://purl.org/dc/elements/1.1/" element="rights"
+          uuid="{@uuid}" lang="{$language}"/></copyright>
+        <pubDate><i18n:date-time locale="en" src-pattern="yyyy-MM-dd hh:mm:ss" pattern="EEE, dd MMM yyyy HH:mm:ss Z" value="{col:document[1]/dc:date}"/></pubDate>
         
         <!--
-        <image>
+          <image>
           <url></url>
           <title></title>
           <link></link>
-        </image>
+          </image>
         -->
         
-        <xsl:apply-templates select="col:document">
-          <xsl:sort order="descending" select="meta:metadata/dc:elements/dc:date"/>
-        </xsl:apply-templates>
+        <xsl:apply-templates select="col:document"/>
         
       </channel>
       
@@ -69,37 +67,38 @@
   </xsl:template>
   
   
-  <xsl:template name="date">
-    <xsl:for-each select="col:document">
-      <xsl:sort select="meta:metadata/dc:elements/dc:date"/>
-      <xsl:if test="position() = 1">
-        <xsl:variable name="date" select="meta:metadata/dc:elements/dc:date"/>
-        <i18n:date-time locale="en" src-pattern="yyyy-MM-dd hh:mm:ss" pattern="EEE, dd MMM yyyy HH:mm:ss Z" value="{$date}" />
-      </xsl:if>
-    </xsl:for-each>
-  </xsl:template>
-
-
-  <xsl:template match="col:document">
+  <xsl:template match="col:document[xhtml:html]">
     <item>
-      <title><xsl:value-of select="meta:metadata/dc:elements/dc:title"/></title>
-      <description><xsl:value-of select="meta:metadata/dc:elements/dc:description"/></description>
+      <title><meta:value element="title" ns="http://purl.org/dc/elements/1.1/" uuid="{@uuid}" lang="{@xml:lang}"/></title>
+      <description><meta:value element="description" ns="http://purl.org/dc/elements/1.1/" uuid="{@uuid}" lang="{@xml:lang}"/></description>
       <xsl:variable name="href">
         <xsl:call-template name="getHref"/>
-      </xsl:variable>
+        </xsl:variable>
       <link><xhtml:a href="{$href}"/></link>
-      <author><xsl:value-of select="meta:metadata/dc:elements/dc:creator"/></author>
-      <xsl:variable name="date" select="meta:metadata/dc:elements/dc:date"/>
-      <pubDate><i18n:date-time locale="en" src-pattern="yyyy-MM-dd hh:mm:ss" pattern="EEE, dd MMM yyyy HH:mm:ss Z" value="{$date}" /></pubDate>
+      <author><meta:value element="creator" ns="http://purl.org/dc/elements/1.1/" uuid="{@uuid}" lang="{@xml:lang}"/></author>
+      <pubDate><i18n:date-time locale="en" src-pattern="yyyy-MM-dd hh:mm:ss" pattern="EEE, dd MMM yyyy HH:mm:ss Z" value="{dc:date}"/></pubDate>
     </item>
   </xsl:template>
-
-
-  <xsl:template match="@*|node()">
+  
+  
+  <xsl:template match="col:document[*[local-name() = 'item']]">
+    <xsl:apply-templates mode="stripNamespace"/>
+  </xsl:template>
+  
+  
+  <xsl:template match="*" mode="stripNamespace">
+    <xsl:element name="{local-name()}">
+      <xsl:apply-templates select="@*"/>
+      <xsl:apply-templates select="node()" mode="stripNamespace"/>
+    </xsl:element>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|node()" priority="-1">
     <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
   </xsl:template>
   
-
+  
 </xsl:stylesheet> 

Modified: lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl?rev=642648&r1=642647&r2=642648&view=diff
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl Sat Mar 29 16:59:00 2008
@@ -6,9 +6,9 @@
   The ASF licenses this file to You 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
-
+  
+  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.
@@ -19,17 +19,17 @@
 <!-- $Id: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
 
 <xsl:stylesheet version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:xhtml="http://www.w3.org/1999/xhtml"
-    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
-    xmlns="http://www.w3.org/1999/xhtml"
-    xmlns:dc="http://purl.org/dc/elements/1.1/"
-    xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
-    xmlns:meta="http://apache.org/cocoon/lenya/metadata/1.0"
-    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
-    exclude-result-prefixes="xhtml lenya col meta dc i18n"
-    >
-    
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:meta="http://apache.org/lenya/meta/1.0/"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+  exclude-result-prefixes="xhtml lenya col meta dc i18n"
+  >
+  
   <xsl:include href="fallback://lenya/modules/xhtml/xslt/helper-object.xsl"/>
   <xsl:include href="shared.xsl"/>
   
@@ -37,16 +37,21 @@
   <xsl:param name="language"/>
   <xsl:param name="pub"/>
   <xsl:param name="area"/>
+  <xsl:param name="uuid"/>
+  <xsl:param name="language"/>
   
   <xsl:variable name="maxChars">100</xsl:variable>
   
   
   <xsl:template match="/col:collection">
-    <xsl:variable name="title" select="meta:metadata/dc:elements/dc:title"/>
     <html>
       <body>
         <div id="body">
-          <h1><xsl:value-of select="$title"/></h1>
+          <div class="rsslink">
+            <a type="application/rss+xml" href="lenya-document:{$uuid},pub={$pub},area={$area},lang={$language}?uuid2url.extension=rss">RSS 2.0</a>
+          </div>
+          <h1><meta:value ns="http://purl.org/dc/elements/1.1/" element="title"
+            uuid="{$uuid}" lang="{$language}"/></h1>
           
           <xsl:if test="$area = 'authoring'">
             <p style="color: #999999;">
@@ -54,36 +59,32 @@
             </p>
           </xsl:if>
           
-          <xsl:choose>
-            <xsl:when test="col:document//xhtml:div[@class = 'newsItem']">
-              <xsl:apply-templates select="col:document//xhtml:div[@class = 'newsItem']">
-                <xsl:sort select="xhtml:h2/xhtml:span[@class = 'newsDate']/i18n:date-time/@value" order="descending"/>
-              </xsl:apply-templates>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:apply-templates select="col:document">
-                <xsl:sort order="descending" select="meta:metadata/dc:elements/dc:date"/>
-              </xsl:apply-templates>
-            </xsl:otherwise>
-          </xsl:choose>
+          <xsl:apply-templates select="col:document"/>
         </div>
       </body>
     </html>
   </xsl:template>
-
-
+  
+  
   <xsl:template match="col:document">
-    <xsl:variable name="date" select="meta:metadata/dc:elements/dc:date"/>
-    <xsl:variable name="title" select="meta:metadata/dc:elements/dc:title"/>
     <div class="newsItem">
       <h2>
         <span class="newsDate">
-          <i18n:date-time src-pattern="yyyy-MM-dd HH:mm:ss" locale="{$language}" value="{$date}" />
+          <i18n:date-time src-pattern="yyyy-MM-dd HH:mm:ss" locale="{$language}" value="{dc:date}" />
         </span><br />
         <xsl:variable name="href">
           <xsl:call-template name="getHref"/>
         </xsl:variable>
-        <a href="{$href}" style="text-decoration: none"><xsl:value-of select="$title"/></a>
+        <a href="{$href}" style="text-decoration: none">
+          <xsl:choose>
+            <xsl:when test="dc:title">
+              <xsl:value-of select="dc:title"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <meta:value element="title" ns="http://purl.org/dc/elements/1.1/" uuid="{@uuid}" lang="{@xml:lang}"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </a>
       </h2>
       <xsl:apply-templates select="xhtml:html/xhtml:body//xhtml:p[1]" mode="excerpt"/>
     </div>
@@ -93,19 +94,20 @@
   <xsl:template match="xhtml:p" mode="excerpt">
     <xsl:copy>
       <xsl:copy-of select="@*"/>
-      <xsl:value-of select="substring(., 1, $maxChars)"/>
-      <xsl:if test="string-length(.) &gt; $maxChars">
+      <xsl:variable name="content" select="."/>
+      <xsl:value-of select="substring($content, 1, $maxChars)"/>
+      <xsl:if test="string-length($content) &gt; $maxChars">
         <xsl:text>&#x2026;</xsl:text>
       </xsl:if>
     </xsl:copy>
   </xsl:template>
-
-
+  
+  
   <xsl:template match="@*|node()">
     <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
   </xsl:template>
   
-
+  
 </xsl:stylesheet> 

Added: lenya/trunk/src/modules/news/xslt/flatten.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/flatten.xsl?rev=642648&view=auto
==============================================================================
--- lenya/trunk/src/modules/news/xslt/flatten.xsl (added)
+++ lenya/trunk/src/modules/news/xslt/flatten.xsl Sat Mar 29 16:59:00 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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:col="http://apache.org/cocoon/lenya/collection/1.0"
+    xmlns:meta="http://apache.org/lenya/meta/1.0/"
+    xmlns:doc="http://apache.org/lenya/metadata/document/1.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    >
+    
+  
+  <xsl:template match="col:document[col:document]">
+    <xsl:apply-templates select="col:document"/>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+
+</xsl:stylesheet> 

Added: lenya/trunk/src/modules/news/xslt/includeSubNews.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/includeSubNews.xsl?rev=642648&view=auto
==============================================================================
--- lenya/trunk/src/modules/news/xslt/includeSubNews.xsl (added)
+++ lenya/trunk/src/modules/news/xslt/includeSubNews.xsl Sat Mar 29 16:59:00 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:col="http://apache.org/cocoon/lenya/collection/1.0"
+  xmlns:meta="http://apache.org/cocoon/lenya/metadata/1.0"
+  xmlns:doc="http://apache.org/lenya/metadata/document/1.0"
+  xmlns:i="http://apache.org/cocoon/include/1.0"
+  >
+  
+  <xsl:param name="pub"/>
+  <xsl:param name="area"/>
+  <xsl:param name="format"/>
+  
+  <xsl:template match="col:document[@uuid]">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+      <i:include src="cocoon:/feedContent/{doc:resourceType}/{$format}/{$pub}/{$area}/{@uuid}/{@xml:lang}" strip-root="true"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="doc:resourceType"/>
+  
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+</xsl:stylesheet> 

Added: lenya/trunk/src/modules/news/xslt/sort.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/sort.xsl?rev=642648&view=auto
==============================================================================
--- lenya/trunk/src/modules/news/xslt/sort.xsl (added)
+++ lenya/trunk/src/modules/news/xslt/sort.xsl Sat Mar 29 16:59:00 2008
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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:col="http://apache.org/cocoon/lenya/collection/1.0"
+    xmlns:meta="http://apache.org/lenya/meta/1.0/"
+    xmlns:doc="http://apache.org/lenya/metadata/document/1.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    >
+    
+  
+  <xsl:template match="/col:collection">
+    <xsl:copy>
+      <xsl:apply-templates select="@*"/>
+      <xsl:apply-templates select="col:document">
+        <xsl:sort select="dc:date" order="descending"/>
+      </xsl:apply-templates>
+    </xsl:copy>
+  </xsl:template>
+  
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+
+</xsl:stylesheet> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org