joerg 2003/10/21 05:44:22
Modified: src/blocks/linkrewriter/samples/bookdemo sitemap.xmap
src/blocks/linkrewriter/samples/sitedemo sitemap.xmap
Added: src/blocks/linkrewriter/samples/stylesheets
absolutize-linkmap.xsl dotdots.xsl
relativize-linkmap.xsl
Removed: src/blocks/linkrewriter/samples/bookdemo/stylesheets
absolutize-linkmap.xsl dotdots.xsl
relativize-linkmap.xsl
src/blocks/linkrewriter/samples/sitedemo/stylesheets
absolutize-linkmap.xsl dotdots.xsl
relativize-linkmap.xsl
Log:
moving the stylesheets one directory up to avoid duplication
Revision Changes Path
1.3 +2 -2
cocoon-2.1/src/blocks/linkrewriter/samples/bookdemo/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/linkrewriter/samples/bookdemo/sitemap.xmap,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sitemap.xmap 13 Mar 2003 09:00:31 -0000 1.2
+++ sitemap.xmap 21 Oct 2003 12:44:22 -0000 1.3
@@ -57,8 +57,8 @@
<map:match pattern="**linkmap">
<map:generate src="docs/book.xml"/>
- <map:transform src="stylesheets/absolutize-linkmap.xsl"/>
- <map:transform src="stylesheets/relativize-linkmap.xsl">
+ <map:transform src="../stylesheets/absolutize-linkmap.xsl"/>
+ <map:transform src="../stylesheets/relativize-linkmap.xsl">
<map:parameter name="path" value="{0}"/>
</map:transform>
<map:serialize type="xml"/>
1.4 +3 -3
cocoon-2.1/src/blocks/linkrewriter/samples/sitedemo/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/linkrewriter/samples/sitedemo/sitemap.xmap,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sitemap.xmap 2 May 2003 13:28:25 -0000 1.3
+++ sitemap.xmap 21 Oct 2003 12:44:22 -0000 1.4
@@ -47,14 +47,14 @@
<map:match pattern="abs-linkmap">
<map:generate src="linkmap.xml"/>
- <map:transform src="stylesheets/absolutize-linkmap.xsl"/>
+ <map:transform src="../stylesheets/absolutize-linkmap.xsl"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="**linkmap">
<map:generate src="linkmap.xml"/>
- <map:transform src="stylesheets/absolutize-linkmap.xsl"/>
- <map:transform src="stylesheets/relativize-linkmap.xsl">
+ <map:transform src="../stylesheets/absolutize-linkmap.xsl"/>
+ <map:transform src="../stylesheets/relativize-linkmap.xsl">
<map:parameter name="path" value="{0}"/>
</map:transform>
<map:serialize type="xml"/>
1.1
cocoon-2.1/src/blocks/linkrewriter/samples/stylesheets/absolutize-linkmap.xsl
Index: absolutize-linkmap.xsl
===================================================================
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="abs">
<xsl:param name="node"/>
<xsl:if test="$node/..">
<xsl:call-template name="abs">
<xsl:with-param name="node" select="$node/.."/>
</xsl:call-template>
</xsl:if>
<xsl:value-of select="$node/@href"/>
</xsl:template>
<xsl:template match="@href">
<xsl:attribute name="href">
<xsl:call-template name="abs">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:attribute>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1
cocoon-2.1/src/blocks/linkrewriter/samples/stylesheets/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.
[EMAIL PROTECTED]
-->
<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.1
cocoon-2.1/src/blocks/linkrewriter/samples/stylesheets/relativize-linkmap.xsl
Index: relativize-linkmap.xsl
===================================================================
<?xml version="1.0"?>
<!-- CVS: $Id: relativize-linkmap.xsl,v 1.1 2003/03/09 00:04:25 pier Exp $ -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="path"/>
<xsl:include href="dotdots.xsl"/>
<!-- Path to site root, eg '../../' -->
<xsl:variable name="root">
<xsl:call-template name="dotdots">
<xsl:with-param name="path" select="$path"/>
</xsl:call-template>
</xsl:variable>
<xsl:template match="@href">
<xsl:attribute name="href">
<xsl:value-of select="$root"/><xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>