You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ug...@apache.org on 2004/09/16 19:03:11 UTC

svn commit: rev 46188 - cocoon/branches/butterfly/src/webapp

Author: ugo
Date: Thu Sep 16 10:03:10 2004
New Revision: 46188

Modified:
   cocoon/branches/butterfly/src/webapp/sitemap.xmap
   cocoon/branches/butterfly/src/webapp/sitemap.xslt
Log:
Continuing sitemap transformation

Modified: cocoon/branches/butterfly/src/webapp/sitemap.xmap
==============================================================================
--- cocoon/branches/butterfly/src/webapp/sitemap.xmap	(original)
+++ cocoon/branches/butterfly/src/webapp/sitemap.xmap	Thu Sep 16 10:03:10 2004
@@ -23,11 +23,11 @@
     </map:match>
     
     <map:match pattern="styles/(.*)\.css">
-      <map:read src="{1}" mime-type="text/css"/>
+      <map:read src="{1}.css" mime-type="text/css"/>
     </map:match>
     
     <map:match pattern="images/(.*)\.gif">
-      <map:read src="{1}" mime-type="image/gif"/>
+      <map:read src="{1}.gif" mime-type="image/gif"/>
     </map:match>
     
   </map:pipeline>

Modified: cocoon/branches/butterfly/src/webapp/sitemap.xslt
==============================================================================
--- cocoon/branches/butterfly/src/webapp/sitemap.xslt	(original)
+++ cocoon/branches/butterfly/src/webapp/sitemap.xslt	Thu Sep 16 10:03:10 2004
@@ -44,12 +44,14 @@
   </xsl:template>
 
   <xsl:template match="map:generate">
-    generate "<xsl:value-of select="@type"/>", "<xsl:value-of select="@src"/>",
+    generate "<xsl:value-of select="@type"/>", <xsl:call-template name="backref">
+      <xsl:with-param name="src" select="@src"/></xsl:call-template>,
     [ <xsl:apply-templates select="map:parameter"/> ];
   </xsl:template>
 
   <xsl:template match="map:transform">
-    transform "<xsl:value-of select="@type"/>", "<xsl:value-of select="@src"/>",
+    transform "<xsl:value-of select="@type"/>", <xsl:call-template name="backref">
+      <xsl:with-param name="src" select="@src"/></xsl:call-template>,
     [ <xsl:apply-templates select="map:parameter"/> ];
   </xsl:template>
 
@@ -65,7 +67,8 @@
         <xsl:otherwise>resource</xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
-    read "<xsl:value-of select="$type"/>", "<xsl:value-of select="@src"/>",
+    read "<xsl:value-of select="$type"/>", <xsl:call-template name="backref">
+      <xsl:with-param name="src" select="@src"/></xsl:call-template>,
     [ "mime-type": "<xsl:value-of select="@mime-type"/>", <xsl:apply-templates select="map:parameter"/> ];
   </xsl:template>
   
@@ -73,4 +76,21 @@
     "<xsl:value-of select="@name"/>": "<xsl:value-of select="@value"/>",
   </xsl:template>
   
+  <xsl:template name="backref">
+    <xsl:param name="src"/>
+    <xsl:choose>
+      <xsl:when test="contains($src, '{')">
+        <xsl:variable name="before" select="substring-before($src, '{')"/>
+        <xsl:variable name="after1" select="substring-after($src, concat($before, '{'))"/>
+        <xsl:variable name="backref" select="substring-before($after1, '}')"/>
+        <xsl:variable name="after" select="substring-after($src, concat($backref, '}'))"/>
+        "<xsl:value-of select="$before"/>" + m.group(<xsl:value-of select="$backref"/>) + 
+        <xsl:call-template name="backref">
+          <xsl:with-param name="src" select="$after"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>"<xsl:value-of select="$src"/>"</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
 </xsl:stylesheet>