svn commit: r605933 - in /lenya/sandbox/modules/feed: sitemap.xmap xslt/atom2collection.xsl

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Dec 20 06:07:16 2007
New Revision: 605933

URL: http://svn.apache.org/viewvc?rev=605933&view=rev
Log:
Add language attributes to documents which are generated by the feed module.

Modified:
    lenya/sandbox/modules/feed/sitemap.xmap
    lenya/sandbox/modules/feed/xslt/atom2collection.xsl

Modified: lenya/sandbox/modules/feed/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/feed/sitemap.xmap?rev=605933&r1=605932&r2=605933&view=diff
==============================================================================
--- lenya/sandbox/modules/feed/sitemap.xmap (original)
+++ lenya/sandbox/modules/feed/sitemap.xmap Thu Dec 20 06:07:16 2007
@@ -30,13 +30,16 @@
 
     <map:pipeline>
       
+      <!-- {1:format}/{2:feedUrl}-->
       <map:match pattern="*/**">
         <map:generate src="{2}"/>
-        <map:transform src="xslt/{1}2collection.xsl"/>
+        <map:transform src="xslt/{1}2collection.xsl">
+          <map:parameter name="language" value="{5}"/>
+        </map:transform>
         <map:transform type="unescape"/>
         <map:transform src="xslt/addXhtmlNamespace.xsl"/>
         <map:transform type="i18n">
-          <map:parameter name="locale" value="en"/>
+          <map:parameter name="locale" value="{5}"/>
         </map:transform>
         <map:serialize type="xml"/>
       </map:match>

Modified: lenya/sandbox/modules/feed/xslt/atom2collection.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/feed/xslt/atom2collection.xsl?rev=605933&r1=605932&r2=605933&view=diff
==============================================================================
--- lenya/sandbox/modules/feed/xslt/atom2collection.xsl (original)
+++ lenya/sandbox/modules/feed/xslt/atom2collection.xsl Thu Dec 20 06:07:16 2007
@@ -28,6 +28,8 @@
   xmlns:unescape="http://apache.org/lenya/unescape/1.0"
   exclude-result-prefixes="atom openSearch">
   
+  <xsl:param name="defaultLanguage" select="'en'"/>
+  
   
   <xsl:template match="atom:feed">
     <col:collection>
@@ -37,7 +39,13 @@
   
   
   <xsl:template match="atom:entry">
-    <col:document href="{atom:link[@type = 'text/html']/@href}">
+    <xsl:variable name="language">
+      <xsl:choose>
+        <xsl:when test="atom:content/@xml:lang"><xsl:value-of select="atom:content/@xml:lang"/></xsl:when>
+        <xsl:otherwise><xsl:value-of select="$defaultLanguage"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <col:document href="{atom:link[@type = 'text/html']/@href}" xml:lang="{$language}">
       <meta:metadata>
         <dc:elements>
           <dc:date>
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.