Author: thorsten
Date: Fri Dec 16 02:36:10 2005
New Revision: 357149

URL: http://svn.apache.org/viewcvs?rev=357149&view=rev
Log:
added new css contract that is working with the old forrest:css element removed 
by the namespace.

Added:
    
forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/common/html/branding-css-links.ft

Added: 
forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/common/html/branding-css-links.ft
URL: 
http://svn.apache.org/viewcvs/forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/common/html/branding-css-links.ft?rev=357149&view=auto
==============================================================================
--- 
forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/common/html/branding-css-links.ft
 (added)
+++ 
forrest/trunk/main/template-sites/v2/src/documentation/resources/themes/common/html/branding-css-links.ft
 Fri Dec 16 02:36:10 2005
@@ -0,0 +1,88 @@
+<?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="branding-css-links">
+  
+  <description>
+    <p>branding-css-links will output html link elements for css usage. </p>
+  </description>
+  <usage><![CDATA[<forrest:contract name="branding-css-links">
+      <forrest:property name="branding-css-links-input">
+        <forrest:css url="common.css"/>
+      </forrest:property>
+    </forrest:contract>]]></usage>
+  <forrest:template xmlns:forrest="http://apache.org/forrest/templates/1.0";
+    name="branding-css-links" inputFormat="xsl">
+    <xsl:stylesheet version="1.1" 
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+      xmlns:forrest="http://apache.org/forrest/templates/1.0";>
+      <xsl:param name="defaultVariables" select="'test.html'"/>
+      <xsl:param name="branding-css-links-input"/>
+      <xsl:variable name="root" select="$defaultVariables/*/[EMAIL 
PROTECTED]'root']/@value"/>
+      <xsl:template match="/">
+        <forrest:content>
+          <forrest:part xpath="/html/head">
+            <xsl:apply-templates select="$branding-css-links-input"/>
+          </forrest:part>
+        </forrest:content>
+      </xsl:template>
+      <xsl:template 
+        match="[EMAIL PROTECTED]">
+        <xsl:copy-of select="@rel"/>
+        <link type="text/css">
+          <xsl:choose>
+            <xsl:when test="@rel">
+              <xsl:attribute name="rel">
+                <xsl:value-of select="@rel"/>
+              </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="rel">stylesheet</xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:choose>
+            <xsl:when test="@theme">
+              <xsl:attribute name="title">
+                <xsl:value-of select="@theme"/>
+              </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="title">
+                <xsl:value-of select="@url"/>
+              </xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:attribute name="href"> <xsl:value-of 
select="$root"/>themes/<xsl:value-of 
+            select="@url"/> </xsl:attribute>
+          <xsl:if test="@media">
+            <xsl:attribute name="media">
+              <xsl:value-of select="@media"/>
+            </xsl:attribute>
+          </xsl:if>
+        </link>
+      </xsl:template>
+      <xsl:template match="css[not(@url)]">
+        <style type="text/css">
+          <xsl:value-of select="."/>
+        </style>
+      </xsl:template>
+    </xsl:stylesheet>
+  </forrest:template>
+</forrest:contract>
\ No newline at end of file


Reply via email to