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 2005/07/27 00:11:12 UTC

svn commit: r225411 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets: hooksMatcher.xsl prepare.xhtml.xsl

Author: thorsten
Date: Tue Jul 26 15:11:06 2005
New Revision: 225411

URL: http://svn.apache.org/viewcvs?rev=225411&view=rev
Log:
Extracted forrest:hook matchers to a stylesheet of its own. Activated the @type and @nbsp attributes. @type='span' will output a span element instead of div. @nbsp='true' will output a &nbsp; which will result in <div> </div> instead of <div/>

Added:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl   (with props)
Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/prepare.xhtml.xsl

Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl?rev=225411&view=auto
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl Tue Jul 26 15:11:06 2005
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 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.
+-->
+
+<xsl:stylesheet version="1.0" 
+  xmlns:forrest="http://apache.org/forrest/templates/1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!--This template will match the different combinations for forrest:hooks-->
+  <xsl:template match="forrest:hook[@name and (@type='div' or not(@type))]">
+    <div id="{@name}">
+      <xsl:apply-templates/>
+      <xsl:if test="@nbsp='true'">&#160;</xsl:if>
+    </div>
+  </xsl:template>
+  <xsl:template match="forrest:hook[@class and (@type='div' or not(@type))]">
+    <div class="{@class}">
+      <xsl:apply-templates/>
+      <xsl:if test="@nbsp='true'">&#160;</xsl:if>
+    </div>
+  </xsl:template>
+  <xsl:template match="forrest:hook[@class and @type='span']">
+    <span class="{@class}"> 
+      <xsl:apply-templates/>
+      <xsl:if test="@nbsp='true'">&#160;</xsl:if>
+    </span>
+  </xsl:template>
+  <xsl:template match="forrest:hook[@name and @type='span']">
+    <span id="{@name}"> 
+      <xsl:apply-templates/>
+      <xsl:if test="@nbsp='true'">&#160;</xsl:if>
+    </span>
+  </xsl:template>
+</xsl:stylesheet>

Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/hooksMatcher.xsl
------------------------------------------------------------------------------
    svn:keywords = Id svn:eol-style=native

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=225411&r1=225410&r2=225411&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 Tue Jul 26 15:11:06 2005
@@ -18,6 +18,8 @@
 
 <xsl:stylesheet version="1.0" xmlns:alias="http://www.w3.org/1999/XSL/TransformAlias" xmlns:forrest="http://apache.org/forrest/templates/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="alias"/>
+    <!--Include forrest:hook matchers-->
+    <xsl:include href="hooksMatcher.xsl"/>
     <xsl:param name="request"/>
     <xsl:param name="forrestContext" select="'test'"/>
     <xsl:template match="/">
@@ -68,16 +70,6 @@
     </xsl:template>
     <xsl:template match="forrest:view">
         <xsl:apply-templates select="*[local-name()!='css']"/>
-    </xsl:template>
-    <xsl:template match="forrest:hook[@name]">
-        <div id="{@name}">
-            <xsl:apply-templates/>
-        </div>
-    </xsl:template>
-    <xsl:template match="forrest:hook[@class]">
-        <div class="{@class}">
-            <xsl:apply-templates/>
-        </div>
     </xsl:template>
     <xsl:template match="forrest:css[@url]">
         <link rel="stylesheet" type="text/css">