forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: rev 21616 - in forrest/trunk/src/core/context: . resources/stylesheets
Date Thu, 24 Jun 2004 00:41:06 GMT
Author: crossley
Date: Wed Jun 23 17:41:06 2004
New Revision: 21616

Added:
   forrest/trunk/src/core/context/resources/stylesheets/normalizehrefs.xsl   (contents, props
changed)
Modified:
   forrest/trunk/src/core/context/menu.xmap
Log:
Normalise dotdots in hrefs.
Only added to menu.xmap (not sure if needed elsewhere).
Submitted by: Lorenz Froihofer
Issue: FOR-111


Modified: forrest/trunk/src/core/context/menu.xmap
==============================================================================
--- forrest/trunk/src/core/context/menu.xmap	(original)
+++ forrest/trunk/src/core/context/menu.xmap	Wed Jun 23 17:41:06 2004
@@ -76,6 +76,7 @@
 
           <map:when test="tab_attributes">
             <map:transform src="{forrest:stylesheets}/site2site-normalizetabs.xsl" />
+            <map:transform src="{forrest:stylesheets}/normalizehrefs.xsl"/>
             <map:transform src="{forrest:stylesheets}/site2site-selectnode.xsl">
               <map:parameter name="path" value="{1}{2}"/>
             </map:transform>

Added: forrest/trunk/src/core/context/resources/stylesheets/normalizehrefs.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/src/core/context/resources/stylesheets/normalizehrefs.xsl	Wed Jun 23 17:41:06
2004
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+Stylesheet to normalize the paths of href attributes, e.g.
+href="somedir/../someotherdir/index.html" ==> href="someotherdir/index.html"
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
+
+  <xsl:include href="../../skins/common/xslt/html/pathutils.xsl" />
+  <xsl:include href="copyover.xsl" />
+  
+  <xsl:template match="@href">
+    <xsl:if test="normalize-space(.)!=''">
+      <xsl:attribute name="href">
+	      <xsl:call-template name="normalize" >
+	        <xsl:with-param name="path" select="." />
+      	</xsl:call-template>
+      </xsl:attribute>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>

Mime
View raw message