You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by kp...@apache.org on 2002/09/10 10:04:51 UTC
cvs commit: xml-forrest/src/resources/skins/avalon-site/xslt/html dotdots.xsl tab2menu.xsl
kpiroumian 2002/09/10 01:04:51
Modified: src/resources/skins/forrest-site/xslt/html tab2menu.xsl
src/resources/conf sitemap.xmap
src/resources/skins/basic/xslt/html tab2menu.xsl
src/resources/skins/xml-apache-site/xslt/html tab2menu.xsl
src/resources/skins/jakarta-site/xslt/html tab2menu.xsl
src/resources/skins/avalon-site/xslt/html tab2menu.xsl
Added: src/resources/skins/forrest-site/xslt/html dotdots.xsl
src/resources/skins/basic/xslt/html dotdots.xsl
src/resources/skins/xml-apache-site/xslt/html dotdots.xsl
src/resources/skins/jakarta-site/xslt/html dotdots.xsl
src/resources/skins/avalon-site/xslt/html dotdots.xsl
Log:
Fix: Make tabs use relative links.
Thanks to Jeff Turner [jefft@apache.org].
Revision Changes Path
1.3 +12 -1 xml-forrest/src/resources/skins/forrest-site/xslt/html/tab2menu.xsl
Index: tab2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/forrest-site/xslt/html/tab2menu.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tab2menu.xsl 30 Jul 2002 01:29:23 -0000 1.2
+++ tab2menu.xsl 10 Sep 2002 08:04:50 -0000 1.3
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="resource"/>
+ <xsl:include href="dotdots.xsl"/>
<xsl:template name="spacer">
<td width="8">
@@ -14,7 +15,17 @@
<tr>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-left.gif" alt="" width="5" height="5" /></td>
<td bgcolor="#B2C4E0" valign="middle">
- <a href="/forrest/{@dir}"><font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$resource"/>
+ </xsl:call-template>
+ <xsl:if test="@dir != ''">
+ <xsl:value-of select="concat(translate(normalize-space(translate(@dir, ' /', '/ ')), ' /', '/ '), '/')"/>
+ <!-- The above expression strips duplicate and trailing /'s. Cunning :) :) -->
+ </xsl:if>
+ </xsl:attribute>
+ <font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
</td>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-right.gif" alt="" width="5" height="5" />
</td>
1.1 xml-forrest/src/resources/skins/forrest-site/xslt/html/dotdots.xsl
Index: dotdots.xsl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Contains the 'dotdots' template, which, given a path, will output a set of
directory traversals to get back to the source directory. Handles both '/' and
'\' directory separators.
Examples:
Input Output
index.html ""
dir/index.html "../"
dir/subdir/index.html "../../"
dir//index.html "../"
dir/ "../"
dir// "../"
\some\windows\path "../../"
\some\windows\path\ "../../../"
\Program Files\mydir "../"
Cannot handle ..'s in the path, so don't expect 'dir/subdir/../index.html' to
work.
jefft@apache.org
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="dotdots">
<xsl:param name="path"/>
<xsl:variable name="dirs" select="normalize-space(translate(concat($path, 'x'), ' /\', '_ '))"/>
<!-- The above does the following:
o Adds a trailing character to the path. This prevents us having to deal
with the special case of ending with '/'
o Translates all directory separators to ' ', and normalize spaces,
cunningly eliminating duplicate '//'s. We also translate any real
spaces into _ to preserve them.
-->
<xsl:variable name="remainder" select="substring-after($dirs, ' ')"/>
<xsl:if test="$remainder">
<xsl:text>../</xsl:text>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="translate($remainder, ' ', '/')"/>
<!-- Translate back to /'s because that's what the template expects. -->
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--
Uncomment to test.
Usage: saxon dotdots.xsl dotdots.xsl path='/my/test/path'
<xsl:param name="path"/>
<xsl:template match="/">
<xsl:message>Path: <xsl:value-of select="$path"/></xsl:message>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:template>
-->
</xsl:stylesheet>
1.16 +12 -0 xml-forrest/src/resources/conf/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/conf/sitemap.xmap,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- sitemap.xmap 30 Jul 2002 11:54:17 -0000 1.15
+++ sitemap.xmap 10 Sep 2002 08:04:50 -0000 1.16
@@ -77,6 +77,10 @@
</map:selectors>
-->
+ <map:actions>
+ <map:action logger="sitemap.action.request" name="request" src="org.apache.cocoon.acting.RequestParamAction"/>
+ </map:actions>
+
<!--
The different pipeline implementations
@@ -329,6 +333,14 @@
<map:generate src="{1}/{2}.xml"/>
<map:transform src="skins/@skin@/xslt/fo/document2fo.xsl"/>
<map:serialize type="fo2pdf"/>
+ </map:match>
+
+ <!-- ================ Directory redirects =========================== -->
+ <!-- Redirect any request for a directory to the directory's index.html file -->
+ <map:match pattern="**/">
+ <map:act type="request">
+ <map:redirect-to uri="{context}/{../1}/index.html"/>
+ </map:act>
</map:match>
<!-- ================ Libre =========================== -->
1.3 +13 -1 xml-forrest/src/resources/skins/basic/xslt/html/tab2menu.xsl
Index: tab2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/basic/xslt/html/tab2menu.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tab2menu.xsl 18 Jun 2002 12:47:18 -0000 1.2
+++ tab2menu.xsl 10 Sep 2002 08:04:50 -0000 1.3
@@ -1,13 +1,25 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="resource"/>
+ <xsl:include href="dotdots.xsl"/>
<xsl:template name="spacer">
<td> | </td>
</xsl:template>
<xsl:template name="not-selected">
- <td> <a href="/{@dir}"><xsl:value-of select="@label"/></a> </td>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$resource"/>
+ </xsl:call-template>
+ <xsl:if test="@dir != ''">
+ <xsl:value-of select="concat(translate(normalize-space(translate(@dir, ' /', '/ ')), ' /', '/ '), '/')"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:value-of select="@label"/></a>
+ </td>
</xsl:template>
<xsl:template name="selected">
1.1 xml-forrest/src/resources/skins/basic/xslt/html/dotdots.xsl
Index: dotdots.xsl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Contains the 'dotdots' template, which, given a path, will output a set of
directory traversals to get back to the source directory. Handles both '/' and
'\' directory separators.
Examples:
Input Output
index.html ""
dir/index.html "../"
dir/subdir/index.html "../../"
dir//index.html "../"
dir/ "../"
dir// "../"
\some\windows\path "../../"
\some\windows\path\ "../../../"
\Program Files\mydir "../"
Cannot handle ..'s in the path, so don't expect 'dir/subdir/../index.html' to
work.
jefft@apache.org
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="dotdots">
<xsl:param name="path"/>
<xsl:variable name="dirs" select="normalize-space(translate(concat($path, 'x'), ' /\', '_ '))"/>
<!-- The above does the following:
o Adds a trailing character to the path. This prevents us having to deal
with the special case of ending with '/'
o Translates all directory separators to ' ', and normalize spaces,
cunningly eliminating duplicate '//'s. We also translate any real
spaces into _ to preserve them.
-->
<xsl:variable name="remainder" select="substring-after($dirs, ' ')"/>
<xsl:if test="$remainder">
<xsl:text>../</xsl:text>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="translate($remainder, ' ', '/')"/>
<!-- Translate back to /'s because that's what the template expects. -->
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--
Uncomment to test.
Usage: saxon dotdots.xsl dotdots.xsl path='/my/test/path'
<xsl:param name="path"/>
<xsl:template match="/">
<xsl:message>Path: <xsl:value-of select="$path"/></xsl:message>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:template>
-->
</xsl:stylesheet>
1.2 +12 -1 xml-forrest/src/resources/skins/xml-apache-site/xslt/html/tab2menu.xsl
Index: tab2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/xml-apache-site/xslt/html/tab2menu.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tab2menu.xsl 7 Jun 2002 20:46:55 -0000 1.1
+++ tab2menu.xsl 10 Sep 2002 08:04:50 -0000 1.2
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="resource"/>
+ <xsl:include href="dotdots.xsl"/>
<xsl:template name="spacer">
<td width="8">
@@ -14,7 +15,17 @@
<tr>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-left.gif" alt="" width="5" height="5" /></td>
<td bgcolor="#B2C4E0" valign="middle">
- <a href="/xml-forrest/{@dir}"><font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$resource"/>
+ </xsl:call-template>
+ <xsl:if test="@dir != ''">
+ <xsl:value-of select="concat(translate(normalize-space(translate(@dir, ' /', '/ ')), ' /', '/ '), '/')"/>
+ <!-- The above expression strips duplicate and trailing /'s. Cunning :) :) -->
+ </xsl:if>
+ </xsl:attribute>
+ <font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
</td>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-right.gif" alt="" width="5" height="5" />
</td>
1.1 xml-forrest/src/resources/skins/xml-apache-site/xslt/html/dotdots.xsl
Index: dotdots.xsl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Contains the 'dotdots' template, which, given a path, will output a set of
directory traversals to get back to the source directory. Handles both '/' and
'\' directory separators.
Examples:
Input Output
index.html ""
dir/index.html "../"
dir/subdir/index.html "../../"
dir//index.html "../"
dir/ "../"
dir// "../"
\some\windows\path "../../"
\some\windows\path\ "../../../"
\Program Files\mydir "../"
Cannot handle ..'s in the path, so don't expect 'dir/subdir/../index.html' to
work.
jefft@apache.org
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="dotdots">
<xsl:param name="path"/>
<xsl:variable name="dirs" select="normalize-space(translate(concat($path, 'x'), ' /\', '_ '))"/>
<!-- The above does the following:
o Adds a trailing character to the path. This prevents us having to deal
with the special case of ending with '/'
o Translates all directory separators to ' ', and normalize spaces,
cunningly eliminating duplicate '//'s. We also translate any real
spaces into _ to preserve them.
-->
<xsl:variable name="remainder" select="substring-after($dirs, ' ')"/>
<xsl:if test="$remainder">
<xsl:text>../</xsl:text>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="translate($remainder, ' ', '/')"/>
<!-- Translate back to /'s because that's what the template expects. -->
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--
Uncomment to test.
Usage: saxon dotdots.xsl dotdots.xsl path='/my/test/path'
<xsl:param name="path"/>
<xsl:template match="/">
<xsl:message>Path: <xsl:value-of select="$path"/></xsl:message>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:template>
-->
</xsl:stylesheet>
1.2 +12 -1 xml-forrest/src/resources/skins/jakarta-site/xslt/html/tab2menu.xsl
Index: tab2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/jakarta-site/xslt/html/tab2menu.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tab2menu.xsl 7 Jun 2002 20:42:39 -0000 1.1
+++ tab2menu.xsl 10 Sep 2002 08:04:51 -0000 1.2
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="resource"/>
+ <xsl:include href="dotdots.xsl"/>
<xsl:template name="spacer">
<td width="8">
@@ -14,7 +15,17 @@
<tr>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-left.gif" alt="" width="5" height="5" /></td>
<td bgcolor="#B2C4E0" valign="middle">
- <a href="/xml-forrest/{@dir}"><font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$resource"/>
+ </xsl:call-template>
+ <xsl:if test="@dir != ''">
+ <xsl:value-of select="concat(translate(normalize-space(translate(@dir, ' /', '/ ')), ' /', '/ '), '/')"/>
+ <!-- The above expression strips duplicate and trailing /'s. Cunning :) :) -->
+ </xsl:if>
+ </xsl:attribute>
+ <font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
</td>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-right.gif" alt="" width="5" height="5" />
</td>
1.1 xml-forrest/src/resources/skins/jakarta-site/xslt/html/dotdots.xsl
Index: dotdots.xsl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Contains the 'dotdots' template, which, given a path, will output a set of
directory traversals to get back to the source directory. Handles both '/' and
'\' directory separators.
Examples:
Input Output
index.html ""
dir/index.html "../"
dir/subdir/index.html "../../"
dir//index.html "../"
dir/ "../"
dir// "../"
\some\windows\path "../../"
\some\windows\path\ "../../../"
\Program Files\mydir "../"
Cannot handle ..'s in the path, so don't expect 'dir/subdir/../index.html' to
work.
jefft@apache.org
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="dotdots">
<xsl:param name="path"/>
<xsl:variable name="dirs" select="normalize-space(translate(concat($path, 'x'), ' /\', '_ '))"/>
<!-- The above does the following:
o Adds a trailing character to the path. This prevents us having to deal
with the special case of ending with '/'
o Translates all directory separators to ' ', and normalize spaces,
cunningly eliminating duplicate '//'s. We also translate any real
spaces into _ to preserve them.
-->
<xsl:variable name="remainder" select="substring-after($dirs, ' ')"/>
<xsl:if test="$remainder">
<xsl:text>../</xsl:text>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="translate($remainder, ' ', '/')"/>
<!-- Translate back to /'s because that's what the template expects. -->
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--
Uncomment to test.
Usage: saxon dotdots.xsl dotdots.xsl path='/my/test/path'
<xsl:param name="path"/>
<xsl:template match="/">
<xsl:message>Path: <xsl:value-of select="$path"/></xsl:message>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:template>
-->
</xsl:stylesheet>
1.2 +12 -1 xml-forrest/src/resources/skins/avalon-site/xslt/html/tab2menu.xsl
Index: tab2menu.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/avalon-site/xslt/html/tab2menu.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tab2menu.xsl 7 Jun 2002 20:18:00 -0000 1.1
+++ tab2menu.xsl 10 Sep 2002 08:04:51 -0000 1.2
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="resource"/>
+ <xsl:include href="dotdots.xsl"/>
<xsl:template name="spacer">
<td width="8">
@@ -14,7 +15,17 @@
<tr>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-left.gif" alt="" width="5" height="5" /></td>
<td bgcolor="#B2C4E0" valign="middle">
- <a href="/xml-forrest/{@dir}"><font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="dotdots">
+ <xsl:with-param name="path" select="$resource"/>
+ </xsl:call-template>
+ <xsl:if test="@dir != ''">
+ <xsl:value-of select="concat(translate(normalize-space(translate(@dir, ' /', '/ ')), ' /', '/ '), '/')"/>
+ <!-- The above expression strips duplicate and trailing /'s. Cunning :) :) -->
+ </xsl:if>
+ </xsl:attribute>
+ <font face="Arial, Helvetica, Sans-serif" size="2"><xsl:value-of select="@label"/></font></a>
</td>
<td bgcolor="#B2C4E0" width="5" valign="top"><img src="skin/images/tab-right.gif" alt="" width="5" height="5" />
</td>
1.1 xml-forrest/src/resources/skins/avalon-site/xslt/html/dotdots.xsl
Index: dotdots.xsl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Contains the 'dotdots' template, which, given a path, will output a set of
directory traversals to get back to the source directory. Handles both '/' and
'\' directory separators.
Examples:
Input Output
index.html ""
dir/index.html "../"
dir/subdir/index.html "../../"
dir//index.html "../"
dir/ "../"
dir// "../"
\some\windows\path "../../"
\some\windows\path\ "../../../"
\Program Files\mydir "../"
Cannot handle ..'s in the path, so don't expect 'dir/subdir/../index.html' to
work.
jefft@apache.org
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="dotdots">
<xsl:param name="path"/>
<xsl:variable name="dirs" select="normalize-space(translate(concat($path, 'x'), ' /\', '_ '))"/>
<!-- The above does the following:
o Adds a trailing character to the path. This prevents us having to deal
with the special case of ending with '/'
o Translates all directory separators to ' ', and normalize spaces,
cunningly eliminating duplicate '//'s. We also translate any real
spaces into _ to preserve them.
-->
<xsl:variable name="remainder" select="substring-after($dirs, ' ')"/>
<xsl:if test="$remainder">
<xsl:text>../</xsl:text>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="translate($remainder, ' ', '/')"/>
<!-- Translate back to /'s because that's what the template expects. -->
</xsl:call-template>
</xsl:if>
</xsl:template>
<!--
Uncomment to test.
Usage: saxon dotdots.xsl dotdots.xsl path='/my/test/path'
<xsl:param name="path"/>
<xsl:template match="/">
<xsl:message>Path: <xsl:value-of select="$path"/></xsl:message>
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:template>
-->
</xsl:stylesheet>