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 2007/05/10 17:51:18 UTC

svn commit: r536892 - /lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl

Author: andreas
Date: Thu May 10 08:51:17 2007
New Revision: 536892

URL: http://svn.apache.org/viewvc?view=rev&rev=536892
Log:
Enable truncating the news message on the overview (default = 100 characters)

Modified:
    lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl

Modified: lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl?view=diff&rev=536892&r1=536891&r2=536892
==============================================================================
--- lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl (original)
+++ lenya/trunk/src/modules/news/xslt/collection2xhtml.xsl Thu May 10 08:51:17 2007
@@ -37,6 +37,8 @@
   <xsl:param name="language"/>
   <xsl:param name="area"/>
   
+  <xsl:variable name="maxChars">100</xsl:variable>
+  
   
   <xsl:template match="/col:collection">
     <xsl:variable name="title" select="meta:metadata/dc:elements/dc:title"/>
@@ -75,7 +77,18 @@
       </xsl:variable>
       <a href="{$href}" style="text-decoration: none"><xsl:value-of select="$title"/></a>
     </h2>
-    <xsl:apply-templates select="xhtml:html/xhtml:body/xhtml:p[1]"/>
+    <xsl:apply-templates select="xhtml:html/xhtml:body/xhtml:p[1]" mode="excerpt"/>
+  </xsl:template>
+  
+  
+  <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:text>&#x2026;</xsl:text>
+      </xsl:if>
+    </xsl:copy>
   </xsl:template>
 
 



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