forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r358325 - /forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl
Date Wed, 21 Dec 2005 16:55:22 GMT
Author: josch
Date: Wed Dec 21 08:55:12 2005
New Revision: 358325

URL: http://svn.apache.org/viewcvs?rev=358325&view=rev
Log:
added new template "add.class" 
* adds a class w/o removing previously set classes and
* w/o inserting unnecessary blanks
applied it to <note> et al. and <code>

Modified:
    forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl

Modified: forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl?rev=358325&r1=358324&r2=358325&view=diff
==============================================================================
--- forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl (original)
+++ forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl Wed Dec 21 08:55:12
2005
@@ -137,7 +137,10 @@
 
   <xsl:template match="note | warning | fixme">
     <xsl:apply-templates select="@id"/>
-    <div class="{local-name()}">
+    <div>
+      <xsl:call-template name="add.class">
+        <xsl:with-param name="class"><xsl:value-of select="local-name()"/></xsl:with-param>
+      </xsl:call-template>
       <div class="label">
         <xsl:choose>
           <!-- FIXME: i18n Transformer here -->
@@ -228,12 +231,9 @@
   <xsl:template match="code">
     <xsl:apply-templates select="@id"/>
     <span>
-      <xsl:attribute name="class">
-        <xsl:choose>
-          <xsl:when test="@class">codefrag <xsl:value-of select="@class"/></xsl:when>
-          <xsl:otherwise>codefrag</xsl:otherwise>
-        </xsl:choose> 
-      </xsl:attribute>
+      <xsl:call-template name="add.class">
+        <xsl:with-param name="class">codefrag</xsl:with-param>
+      </xsl:call-template>
       <xsl:copy-of select="@id"/>
       <xsl:value-of select="."/>
     </span>
@@ -383,6 +383,24 @@
         <xsl:with-param name="level" select="$level+1"/>
       </xsl:apply-templates>
     </tocitem>
+  </xsl:template>
+
+  <xsl:template name="add.class">
+    <!-- use the parameter to set class attribute -->
+    <!-- if there are already classes set, adds to them -->
+    <xsl:param name="class"/> 
+    <xsl:attribute name="class">
+      <xsl:choose>
+        <xsl:when test="@class">
+          <xsl:value-of select="$class"/>
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="@class"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$class"/>
+        </xsl:otherwise>
+      </xsl:choose> 
+    </xsl:attribute>
   </xsl:template>
 
   <xsl:template match="node()|@*" mode="toc"/>



Mime
View raw message