You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2009/03/04 11:35:01 UTC

svn commit: r749960 - in /forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher: src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/ themer/themes/common/html/

Author: thorsten
Date: Wed Mar  4 10:35:00 2009
New Revision: 749960

URL: http://svn.apache.org/viewvc?rev=749960&view=rev
Log:
Fixing branding contract to minimize whitespaces.

Modified:
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/branding-css-links.contract.xml
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/branding-css-links.contract.xml

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/branding-css-links.contract.xml
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/branding-css-links.contract.xml?rev=749960&r1=749959&r2=749960&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/branding-css-links.contract.xml (original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/branding-css-links.contract.xml Wed Mar  4 10:35:00 2009
@@ -72,6 +72,7 @@
 <![CDATA[<forrest:contract name="branding-css-links">
       <forrest:property name="branding-css-links-input">
         <css url="common.css"/>
+        <css if="IE 7" .../>
         <css .../>
       </forrest:property>
     </forrest:contract>]]>
@@ -88,17 +89,32 @@
       <xsl:template match="/">
         <forrest:content>
           <forrest:part xpath="/html/head">
-            <xsl:apply-templates select="$branding-css-links-input"/>
+            <xsl:apply-templates select="$branding-css-links-input/*"/>
           </forrest:part>
         </forrest:content>
       </xsl:template>
       <xsl:template 
         match="css[@url]">
-        <xsl:copy-of select="@rel"/><link type="text/css">
+        <xsl:variable name="if" select="normalize-space(@if)"/>
+        <xsl:choose>
+          <xsl:when test="$if">
+           <xsl:variable name="ifComment"
+            select="concat('[if ',$if,']>')"/>
+            <xsl:comment><xsl:value-of select="$ifComment"/>
+             <xsl:call-template name="printLinkText"/>
+            &lt;![endif]</xsl:comment>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="printLink"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:template>
+      <xsl:template name="printLink">
+        <link type="text/css">
         <xsl:choose>
           <xsl:when test="@rel">
             <xsl:attribute name="rel">
-              <xsl:value-of select="@rel"/>
+              <xsl:value-of select="normalize-space(@rel)"/>
             </xsl:attribute>
           </xsl:when>
           <xsl:otherwise>
@@ -108,7 +124,7 @@
         <xsl:choose>
           <xsl:when test="@theme">
             <xsl:attribute name="title">
-              <xsl:value-of select="@theme"/>
+              <xsl:value-of select="normalize-space(@theme)"/>
             </xsl:attribute>
           </xsl:when>
           <xsl:otherwise>
@@ -120,7 +136,7 @@
         <xsl:variable name="prefix">
           <xsl:choose>
             <xsl:when test="@prefix">
-              <xsl:value-of select="@prefix"/>
+              <xsl:value-of select="normalize-space(@prefix)"/>
             </xsl:when>
             <xsl:otherwise>
                 themes/
@@ -137,10 +153,38 @@
         </xsl:attribute>
         <xsl:if test="@media">
           <xsl:attribute name="media">
-            <xsl:value-of select="@media"/>
+            <xsl:value-of select="normalize-space(@media)"/>
           </xsl:attribute>
         </xsl:if></link>
       </xsl:template>
+        <xsl:template name="printLinkText">
+          <xsl:variable name="out">
+           &lt;link type="text/css"
+            <xsl:choose>
+              <xsl:when test="@rel"> rel="<xsl:value-of select="normalize-space(@rel)"/>" </xsl:when>
+              <xsl:otherwise> rel="stylesheet" </xsl:otherwise>
+            </xsl:choose>
+            <xsl:choose>
+              <xsl:when test="@theme"> title="<xsl:value-of select="normalize-space(@theme)"/>" </xsl:when>
+              <xsl:otherwise> title="<xsl:value-of
+                  select="concat( translate( substring($theme, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring($theme,2))"/>
+                " </xsl:otherwise>
+            </xsl:choose>
+            <xsl:variable name="prefix">
+              <xsl:choose>
+                <xsl:when test="@prefix">
+                  <xsl:value-of select="normalize-space(@prefix)"/>
+                </xsl:when>
+                <xsl:otherwise>themes/</xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable> href="<xsl:value-of select="$root"/>
+            <xsl:value-of select="normalize-space($prefix)"/>
+            <xsl:value-of select="normalize-space(@url)"/>"
+            <xsl:if test="@media"> media="<xsl:value-of select="normalize-space(@media)"/>"</xsl:if> 
+           </xsl:variable>
+         <xsl:variable name="printIt" 
+          select="concat(normalize-space($out),'/>')"/>
+          <xsl:value-of select="normalize-space($printIt)"/></xsl:template>
       <xsl:template match="css[not(@url)]">
         <style type="text/css">
           <xsl:value-of select="."/>

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/branding-css-links.contract.xml
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/branding-css-links.contract.xml?rev=749960&r1=749959&r2=749960&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/branding-css-links.contract.xml (original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/themer/themes/common/html/branding-css-links.contract.xml Wed Mar  4 10:35:00 2009
@@ -95,11 +95,13 @@
       </xsl:template>
       <xsl:template 
         match="css[@url]">
-        <xsl:variable name="if" select="@if"/>
+        <xsl:variable name="if" select="normalize-space(@if)"/>
         <xsl:choose>
           <xsl:when test="$if">
-            <xsl:comment>[if <xsl:value-of select="$if"/>]><xsl:call-template name="printLinkText"/>
-
+           <xsl:variable name="ifComment"
+            select="concat('[if ',$if,']>')"/>
+            <xsl:comment><xsl:value-of select="$ifComment"/>
+             <xsl:call-template name="printLinkText"/>
             &lt;![endif]</xsl:comment>
           </xsl:when>
           <xsl:otherwise>
@@ -108,27 +110,24 @@
         </xsl:choose>
       </xsl:template>
       <xsl:template name="printLink">
-
         <link type="text/css">
         <xsl:choose>
           <xsl:when test="@rel">
             <xsl:attribute name="rel">
-              <xsl:value-of select="@rel"/>
+              <xsl:value-of select="normalize-space(@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:value-of select="normalize-space(@theme)"/>
             </xsl:attribute>
           </xsl:when>
           <xsl:otherwise>
-
             <xsl:attribute name="title">
               <xsl:value-of select="concat( translate( substring($theme, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring($theme,2))"/>
             </xsl:attribute>
@@ -137,8 +136,7 @@
         <xsl:variable name="prefix">
           <xsl:choose>
             <xsl:when test="@prefix">
-              <xsl:value-of select="@prefix"/>
-
+              <xsl:value-of select="normalize-space(@prefix)"/>
             </xsl:when>
             <xsl:otherwise>
                 themes/
@@ -150,48 +148,46 @@
             select="$root"/>
           <xsl:value-of 
             select="normalize-space($prefix)"/>
-
           <xsl:value-of 
             select="@url"/>
         </xsl:attribute>
         <xsl:if test="@media">
           <xsl:attribute name="media">
-            <xsl:value-of select="@media"/>
+            <xsl:value-of select="normalize-space(@media)"/>
           </xsl:attribute>
         </xsl:if></link>
       </xsl:template>
         <xsl:template name="printLinkText">
-
           <xsl:variable name="out">
+           &lt;link type="text/css"
             <xsl:choose>
-              <xsl:when test="@rel"> rel="<xsl:value-of select="@rel"/>" </xsl:when>
+              <xsl:when test="@rel"> rel="<xsl:value-of select="normalize-space(@rel)"/>" </xsl:when>
               <xsl:otherwise> rel="stylesheet" </xsl:otherwise>
             </xsl:choose>
             <xsl:choose>
-
-              <xsl:when test="@theme"> title="<xsl:value-of select="@theme"/>" </xsl:when>
+              <xsl:when test="@theme"> title="<xsl:value-of select="normalize-space(@theme)"/>" </xsl:when>
               <xsl:otherwise> title="<xsl:value-of
                   select="concat( translate( substring($theme, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring($theme,2))"/>
                 " </xsl:otherwise>
             </xsl:choose>
             <xsl:variable name="prefix">
               <xsl:choose>
-
                 <xsl:when test="@prefix">
-                  <xsl:value-of select="@prefix"/>
+                  <xsl:value-of select="normalize-space(@prefix)"/>
                 </xsl:when>
-                <xsl:otherwise> themes/ </xsl:otherwise>
+                <xsl:otherwise>themes/</xsl:otherwise>
               </xsl:choose>
             </xsl:variable> href="<xsl:value-of select="$root"/>
             <xsl:value-of select="normalize-space($prefix)"/>
-
-            <xsl:value-of select="@url"/>
-            <xsl:if test="@media">" media="<xsl:value-of select="@media"/>" </xsl:if> </xsl:variable>
-          &lt;link type="text/css" <xsl:value-of select="normalize-space($out)"/>> </xsl:template>
+            <xsl:value-of select="normalize-space(@url)"/>"
+            <xsl:if test="@media"> media="<xsl:value-of select="normalize-space(@media)"/>"</xsl:if> 
+           </xsl:variable>
+         <xsl:variable name="printIt" 
+          select="concat(normalize-space($out),'/>')"/>
+          <xsl:value-of select="normalize-space($printIt)"/></xsl:template>
       <xsl:template match="css[not(@url)]">
         <style type="text/css">
           <xsl:value-of select="."/>
-
         </style>
       </xsl:template>
     </xsl:stylesheet>