forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: rev 43410 - in forrest/trunk/src/core/context: . resources/stylesheets
Date Mon, 06 Sep 2004 06:42:51 GMT
Author: crossley
Date: Sun Sep  5 23:42:51 2004
New Revision: 43410

Added:
   forrest/trunk/src/core/context/resources/stylesheets/extract-svg.xsl   (contents, props
changed)
Modified:
   forrest/trunk/src/core/context/resources.xmap
   forrest/trunk/src/core/context/resources/stylesheets/project2text.xsl
Log:
Better handling of the two cases of SVG generation and skinconf aggregation.
See FOR-229 for background discussion.

- src/core/context/resources/stylesheets/project2text.xsl
Replace to call to document() to get the configuration with a simple
reference to '//skinconf' since the skinconf.xml has been <map:aggregate>'d.

- src/core/context/resources.xmap
Replace the 'generate-resource' <map:resource> with two new <map:resources>:
'generate-aggregate-resource' and 'generate-transformed-resource' to reflect
the difference in using the skinconf.xml in a resource versus transforming
the skinconf.xml into a new resource.
Also replaced the 'pipe-svg2png-resource' <map:resource> with
'pipe-aggregated-svg2png-resource' and 'pipe-transformed-svg2png-resource'
to reflect the difference between the resources that use skinconf.xml and
those that transform it.
Changed the calls to resources that use .svg.xslt to use the
'pipe-transformed-svg2png-resource' and those that use the simple .svg
files to use the 'pipe-aggregated-svg2png-resource'.

- src/core/context/resources/stylesheets/extract-svg.xsl
This is used in the transformation of the aggregated SVG to extract ONLY
the SVG itself. Batik requires that the top element be <svg> and in the
aggregation, we have the <skinconf> and containing element after the
transformation.

Submitted by: Rick Tessner
Issue: FOR-229


Modified: forrest/trunk/src/core/context/resources.xmap
==============================================================================
--- forrest/trunk/src/core/context/resources.xmap	(original)
+++ forrest/trunk/src/core/context/resources.xmap	Sun Sep  5 23:42:51 2004
@@ -78,7 +78,7 @@
                   </map:call>
                </map:when>
                <map:when test="{project:skins-dir}{forrest:skin}/{path}/{name}.svg.xslt">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-transformed-svg2png-resource">
                     <map:parameter name="path" value="{project:skins-dir}{forrest:skin}/{path}/{name}.svg.xslt"
/>
                   </map:call>
                </map:when>
@@ -100,7 +100,7 @@
                   </map:call>
                </map:when>
                <map:when test="{forrest:context}/skins/{forrest:skin}/{path}/{name}.svg.xslt">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-transformed-svg2png-resource">
                     <map:parameter name="path" value="{forrest:context}/skins/{forrest:skin}/{path}/{name}.svg.xslt"
/>
                   </map:call>
                </map:when>
@@ -121,7 +121,7 @@
                   </map:call>
                </map:when>
                <map:when test="{forrest:context}/skins/common/{path}/{name}.svg.xslt">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-transformed-svg2png-resource">
                     <map:parameter name="path" value="{forrest:context}/skins/common/{path}/{name}.svg.xslt"
/>
                   </map:call>
                </map:when>
@@ -135,7 +135,7 @@
        <map:resource name="read-svg2png-corner-resource">
             <map:select type="exists">
                <map:when test="{project:skins-dir}{forrest:skin}/{path}/{name}.svg.xslt">
-                  <map:call resource="pipe-svg2png-corner-resource">
+                  <map:call resource="pipe-transformed-svg2png-corner-resource">
                     <map:parameter name="path" value="{project:skins-dir}{forrest:skin}/{path}/{name}.svg.xslt"
/>
                     <map:parameter name="orientation-tb" value="{orientation-tb}"/>
                     <map:parameter name="orientation-lr" value="{orientation-lr}"/>
@@ -146,7 +146,7 @@
                   </map:call>
                </map:when>
                <map:when test="{forrest:context}/skins/{forrest:skin}/{path}/{name}.svg.xslt">
-                  <map:call resource="pipe-svg2png-corner-resource">
+                  <map:call resource="pipe-transformed-svg2png-corner-resource">
                     <map:parameter name="path" value="{forrest:context}/skins/{forrest:skin}/{path}/{name}.svg.xslt"
/>
                     <map:parameter name="orientation-tb" value="{orientation-tb}"/>
                     <map:parameter name="orientation-lr" value="{orientation-lr}"/>
@@ -171,14 +171,23 @@
       </map:resource>
       
       <map:resource name="pipe-text-resource">
-        <map:call resource="generate-resource">
+        <map:call resource="generate-transformed-resource">
            <map:parameter name="path" value="{path}" />
          </map:call>
          <map:serialize type="text" mime-type="{mime-type}"/>
       </map:resource>
 
-      <map:resource name="pipe-svg2png-resource">
-         <map:call resource="generate-resource">
+      <map:resource name="pipe-aggregate-svg2png-resource">
+         <map:call resource="generate-aggregate-resource">
+           <map:parameter name="path" value="{path}" />
+         </map:call>
+         <map:call resource="transform-project2text"/>
+         <map:transform src="{forrest:stylesheets}/extract-svg.xsl"/>
+         <map:serialize type="svg2png" />
+      </map:resource>
+
+      <map:resource name="pipe-transformed-svg2png-resource">
+         <map:call resource="generate-transformed-resource">
            <map:parameter name="path" value="{path}" />
          </map:call>
          <map:call resource="transform-project2text"/>
@@ -205,15 +214,20 @@
         <map:serialize type="svg2png" />
       </map:resource>
       
-      <map:resource name="generate-resource">
+      <map:resource name="generate-aggregate-resource">
+        <map:aggregate element="resource">
+          <map:part src="cocoon://skinconf.xml" />
+          <map:part src="{path}"/>
+        </map:aggregate>
+      </map:resource>
+      
+      <map:resource name="generate-transformed-resource">
         <map:generate src="cocoon://skinconf.xml" />
         <map:transform src="{path}"/>
       </map:resource>
       
       <map:resource name="transform-project2text">
-         <map:transform src="{forrest:stylesheets}/project2text.xsl">
-            <map:parameter name="config-file" value="{project:skinconf}"/>
-         </map:transform>      
+         <map:transform src="{forrest:stylesheets}/project2text.xsl"/>
       </map:resource>
       
       <map:resource name="read-linked-text">
@@ -278,7 +292,7 @@
             </map:call>
          </map:match>
 
-         <!-- DS: handles images local to a contributor directory -->
+         <!-- handles images local to a contributor directory -->
          <map:match pattern="**my-images/**.*">
             <map:read src="{project:content.xdocs}{1}my-images/{2}.{3}" mime-type="image/{3}"
/>
          </map:match>
@@ -286,17 +300,17 @@
          <map:match pattern="images/**.png">
             <map:select type="exists">
                <map:when test="{project:content.xdocs}/images/{1}.svg">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-aggregate-svg2png-resource">
                     <map:parameter name="path" value="{project:content.xdocs}/images/{1}.svg"
/>
                   </map:call>
                </map:when>
                <map:when test="{project:resources.images}/{1}.svg">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-aggregate-svg2png-resource">
                     <map:parameter name="path" value="{project:resources.images}/{1}.svg"
/>
                   </map:call>
                </map:when>
                <map:when test="resources/images/{1}.svg">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-aggregate-svg2png-resource">
                     <map:parameter name="path" value="resources/images/{1}.svg" />
                   </map:call>
                </map:when>
@@ -363,7 +377,7 @@
          <map:match pattern="**.png">
             <map:select type="exists">
                <map:when test="{project:content.xdocs}/{1}.svg">
-                  <map:call resource="pipe-svg2png-resource">
+                  <map:call resource="pipe-aggregate-svg2png-resource">
                     <map:parameter name="path" value="{project:content.xdocs}/{1}.svg"
/>
                   </map:call>
                </map:when>

Added: forrest/trunk/src/core/context/resources/stylesheets/extract-svg.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/src/core/context/resources/stylesheets/extract-svg.xsl	Sun Sep  5 23:42:51
2004
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  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.
+-->
+
+<!--+
+    | Replace element for the value on the project descriptor 
+    | xmlns:for has to be replaced for the final version
+    +-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:svg="http://www.w3.org/2000/svg" version="1.0">
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//svg:svg"/>
+  </xsl:template>
+
+  <xsl:template match="svg:svg">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*"/>
+
+</xsl:stylesheet>

Modified: forrest/trunk/src/core/context/resources/stylesheets/project2text.xsl
==============================================================================
--- forrest/trunk/src/core/context/resources/stylesheets/project2text.xsl	(original)
+++ forrest/trunk/src/core/context/resources/stylesheets/project2text.xsl	Sun Sep  5 23:42:51
2004
@@ -24,8 +24,7 @@
 
 <xsl:import href="copyover.xsl"/>
 
-<xsl:param name="config-file" />
-  <xsl:variable name="config" select="document($config-file)/skinconfig"/>
+<xsl:variable name="config" select="//skinconfig"/>
 
 <xsl:template match="for:project-name">
     <xsl:value-of select="$config/project-name"/>

Mime
View raw message