Author: thorsten
Date: Sun Mar  5 02:42:57 2006
New Revision: 383303

URL: http://svn.apache.org/viewcvs?rev=383303&view=rev
Log:
Extracting the render-logo again to a contract to its own. The helper contract 
can only be used internally from within other contracts! Demonstrating how to 
include/import different contracts from within the branding-logo contract.

Added:
    
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft
   (with props)
Modified:
    
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft

Modified: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft
URL: 
http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft?rev=383303&r1=383302&r2=383303&view=diff
==============================================================================
--- 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft
 (original)
+++ 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/branding-logo.ft
 Sun Mar  5 02:42:57 2006
@@ -34,6 +34,7 @@
 
     <xsl:stylesheet version="1.1" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+        <xsl:include 
href="cocoon://prepare.contract.html.helper-render-image"/>
         <xsl:param name="defaultVariables" select="'test.html'"/>
         <xsl:param name="branding-logo-name"/>
         <xsl:param name="branding-logo-description"/>
@@ -61,40 +62,6 @@
         </forrest:content>
       </xsl:template>
 
-      <!-- FIXME : in the previous dispatcher, this template was defined in an 
external render-logo.xsl... -->
-      <xsl:template name="renderlogo">
-        <xsl:param name="name"/>
-        <xsl:param name="url"/>
-        <xsl:param name="logo"/>
-        <xsl:param name="width"/>
-        <xsl:param name="height"/>
-        <xsl:param name="root"/>
-        <xsl:param name="description"/>
-        <a href="{$url}">
-          <xsl:choose>
-            <xsl:when test="$logo and not($logo = '')">
-              <img alt="{$name}" class="logoImage">
-                <xsl:attribute name="src">
-                  <xsl:if test="not(starts-with($logo, 'http://'))">
-                    <xsl:value-of select="$root"/>
-                  </xsl:if>
-                  <xsl:value-of select="$logo"/>
-                </xsl:attribute>
-                <xsl:if test="$width">
-                  <xsl:attribute name="width"><xsl:value-of 
select="$width"/></xsl:attribute>
-                </xsl:if>
-                <xsl:if test="$height">
-                  <xsl:attribute name="height"><xsl:value-of 
select="$height"/></xsl:attribute>
-                </xsl:if>
-                <xsl:if test="$description">
-                  <xsl:attribute name="title"><xsl:value-of 
select="$description"/></xsl:attribute>
-                </xsl:if>
-              </img>
-            </xsl:when>
-            <xsl:otherwise><xsl:value-of select="$name"/></xsl:otherwise>
-          </xsl:choose>
-        </a>
-      </xsl:template>
     </xsl:stylesheet>
 
   </forrest:template>

Added: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft
URL: 
http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft?rev=383303&view=auto
==============================================================================
--- 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft
 (added)
+++ 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft
 Sun Mar  5 02:42:57 2006
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2005 The Apache Software Foundation or its licensors,
+  as applicable.
+
+  Licensed 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.
+-->
+<forrest:contract 
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
+  xmlns:forrest="http://apache.org/forrest/templates/1.0";
+  name="helper-render-image">
+  
+  
+  <description>
+    <p>helper-render-image is a helper class to be used <strong>only</strong> 
+      internally as import/include from within other contracts!</p>
+  </description>
+  <usage><![CDATA[internal only!!!
+  
+  <xsl:include 
href="cocoon://prepare.contract.html.helper-render-image"/>]]></usage>
+  <forrest:template xmlns:forrest="http://apache.org/forrest/templates/1.0";
+    name="helper-render-image" inputFormat="xsl">
+    <xsl:stylesheet version="1.1" 
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+      <xsl:template name="renderlogo">
+        <xsl:param name="name"/>
+        <xsl:param name="url"/>
+        <xsl:param name="logo"/>
+        <xsl:param name="width"/>
+        <xsl:param name="height"/>
+        <xsl:param name="root"/>
+        <xsl:param name="description"/>
+        <a href="{$url}">
+          <xsl:choose>
+            <xsl:when test="$logo and not($logo = '')">
+              <img alt="{$name}" class="logoImage">
+                <xsl:attribute name="src">
+                  <xsl:if test="not(starts-with($logo, 'http://'))">
+                    <xsl:value-of select="$root"/>
+                  </xsl:if>
+                  <xsl:value-of select="$logo"/>
+                </xsl:attribute>
+                <xsl:if test="$width">
+                  <xsl:attribute name="width"><xsl:value-of 
select="$width"/></xsl:attribute>
+                </xsl:if>
+                <xsl:if test="$height">
+                  <xsl:attribute name="height"><xsl:value-of 
select="$height"/></xsl:attribute>
+                </xsl:if>
+                <xsl:if test="$description">
+                  <xsl:attribute name="title"><xsl:value-of 
select="$description"/></xsl:attribute>
+                </xsl:if>
+              </img>
+            </xsl:when>
+            <xsl:otherwise><xsl:value-of select="$name"/></xsl:otherwise>
+          </xsl:choose>
+        </a>
+      </xsl:template>
+    </xsl:stylesheet>
+  </forrest:template>
+</forrest:contract>
\ No newline at end of file

Propchange: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/helper-render-image.ft
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to