forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r225651 - /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl
Date Wed, 27 Jul 2005 23:23:45 GMT
Author: thorsten
Date: Wed Jul 27 16:23:41 2005
New Revision: 225651

URL: http://svn.apache.org/viewcvs?rev=225651&view=rev
Log:
fixed the multiple include of head templates calls and as well the css include. Now even if
we use twice a contract that is requesting {contract-name}-head it just get called once. The
same is true for forrest:css. If you use two times the same @url it still only get includes
once.

Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl?rev=225651&r1=225650&r2=225651&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl
Wed Jul 27 16:23:41 2005
@@ -22,6 +22,8 @@
     <xsl:include href="hooksMatcher.xsl"/>
     <xsl:param name="request"/>
     <xsl:param name="forrestContext" select="'test'"/>
+    <xsl:key name="head-template" match="forrest:property[@format='xhtml']" use="@name"
/>
+    <xsl:key name="css-includes" match="forrest:css" use="@url" />
     <xsl:template match="/">
     	<!--Create the final stylesheet (alias:)-->
         <alias:stylesheet version="1.0">
@@ -33,7 +35,7 @@
             <alias:param name="path"/>
             <xsl:comment>All xhtml head elements requested by the forrest:template</xsl:comment>
             <alias:template name="getHead">
-                <xsl:for-each select="/*/forrest:properties/*[@head='true']">
+                <xsl:for-each select="/*/forrest:properties/*[@head='true' and count(.
| key('head-template', @name)[1]) = 1]">
                     <alias:call-template name="{@name}-head"/>
                 </xsl:for-each>
             </alias:template>
@@ -71,7 +73,7 @@
     <xsl:template match="forrest:view">
         <xsl:apply-templates select="*[local-name()!='css']"/>
     </xsl:template>
-    <xsl:template match="forrest:css[@url]">
+    <xsl:template match="forrest:css[@url and count(. | key('css-includes', @name)[1])
= 1]">
         <link rel="stylesheet" type="text/css">
             <xsl:attribute name="href">{$root}skin/<xsl:value-of select="@url"/>
             </xsl:attribute>



Mime
View raw message