You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2004/10/15 02:48:16 UTC

svn commit: rev 54812 - in forrest/branches/sitemap-plugins/plugins/IMSManifest: . resources resources/stylesheets

Author: rgardler
Date: Thu Oct 14 17:48:14 2004
New Revision: 54812

Added:
   forrest/branches/sitemap-plugins/plugins/IMSManifest/
   forrest/branches/sitemap-plugins/plugins/IMSManifest/README.txt   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/
   forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/
   forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/imsmanifest2site.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/imsmanifest2tabs.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/pathutils.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/repositoryUtils.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest/sitemap.xmap   (contents, props changed)
Log:
add deelopment code for IMSManifest plugin

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest/README.txt
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest/README.txt	Thu Oct 14 17:48:14 2004
@@ -0,0 +1,35 @@
+IMSManifest Plugin
+===================
+
+This plugin allows IMS SCORM Manifest files to be used as an alternative to the 
+site.xml and tabs.xml files. If a file named imsmanifest.xml is found in 
+the xdocs directory of a project this will be used to generate the reqruied
+files for Forrest to run.
+
+Also allows content from another Content Package defiend with an IMS Manifest 
+to be included within a second Content Package.
+
+Known Issues
+============
+
+- location of repository is hard coded in imsmanifest2site.xsl and sitemap.xsl
+
+Version
+=======
+
+0.1-dev
+
+Code, interfaces and functionality are likely to change. Use at your own risk.
+
+ToDo
+====
+
+- remove hard coded references to the repository
+
+- check there is not already a way of encoding embedded objects in an IMS Manifest
+
+- provide and example
+
+- documentation
+  
+

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/imsmanifest2site.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/imsmanifest2site.xsl	Thu Oct 14 17:48:14 2004
@@ -0,0 +1,173 @@
+<?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.
+-->
+<!--
+Stylesheet for generating site.xml from a IMS Manifest file.
+-->
+
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:ims="http://www.imsproject.org/xsd/imscp_rootv1p1p2"
+  xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2">
+  
+  <xsl:import href="pathutils.xsl"/>
+  <xsl:import href="repositoryUtils.xsl"/>
+  
+  <xsl:output doctype-system="http://apache.org/forrest/dtd/tab-cocoon-v11.dtd"
+    doctype-public="-//APACHE//DTD Cocoon Documentation Tab V1.1//EN"/>
+
+  <xsl:template match="/">
+    <site label="MyProj" 
+      href="" 
+      xmlns="http://apache.org/forrest/linkmap/1.0"
+      tab="">
+      
+      <xsl:apply-templates/>
+      
+    </site>
+  </xsl:template>
+  
+  <xsl:template match="ims:manifest">
+    <xsl:param name="asset_base"/>
+    <xsl:apply-templates>
+      <xsl:with-param name="asset_base"><xsl:value-of select="$asset_base"/></xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:template>
+  
+  <xsl:template match="ims:organizations">
+    <xsl:param name="asset_base"/>
+    <xsl:apply-templates select="ims:organization">
+      <xsl:with-param name="asset_base"><xsl:value-of select="$asset_base"/></xsl:with-param>
+    </xsl:apply-templates>
+  </xsl:template>
+  
+  <xsl:template match="ims:organization">
+    <xsl:param name="asset_base"/>
+    <xsl:variable name="title">
+      <xsl:choose>
+        <xsl:when test="./ims:title">
+          <xsl:value-of select="./ims:title"/>
+        </xsl:when>
+        <xsl:otherwise>
+          FIXME: Organisation Title Missing
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="element_name">organisation</xsl:variable>
+    <xsl:element name="{$element_name}">
+      <xsl:attribute name="label"><xsl:value-of select="$title"/></xsl:attribute>
+      <xsl:apply-templates select="ims:item">
+        <xsl:with-param name="asset_base"><xsl:value-of select="$asset_base"/></xsl:with-param>
+      </xsl:apply-templates>
+    </xsl:element>
+  </xsl:template>
+    
+  <xsl:template match="ims:item[@identifierref]">
+    <xsl:param name="asset_base"/>
+    <xsl:variable name="idref"><xsl:value-of select="@identifierref"/></xsl:variable>
+    <xsl:variable name="burrokeetCommand">
+      <xsl:call-template name="getRepositoryCommand">
+        <xsl:with-param name="path"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/@href"/></xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="scoName">
+      <xsl:call-template name="getSCOName">
+        <xsl:with-param name="path"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/@href"/></xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$burrokeetCommand='getSCO'">
+        <xsl:variable name="scoName"><xsl:call-template name="getSCOName"><xsl:with-param name="path"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/@href"/></xsl:with-param></xsl:call-template></xsl:variable>
+        <!-- FIXME: remove hard coded path name (also in sitemap.xmap) -->
+        <xsl:variable name="sco">file:///D:/projects/burrokeet/repositoryData/<xsl:value-of select="$scoName"/>/src/documentation/content/xdocs/imsmanifest.xml</xsl:variable>
+        <xsl:apply-templates select="document($sco)/ims:manifest">
+          <xsl:with-param name="asset_base">getSCO/<xsl:value-of select="$scoName"/>/</xsl:with-param>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="title"><xsl:value-of select="ims:title"/></xsl:variable>
+        <xsl:variable name="package_base"><xsl:value-of select="$asset_base"/><xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/../../@xml:base"/></xsl:variable>
+        <xsl:variable name="path_href">
+          <xsl:choose>
+            <xsl:when test="//ims:resources/ims:resource[@identifier=$idref]/ims:file">
+              <xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/ims:file/@href"/>
+      			</xsl:when>
+			      <xsl:otherwise>
+			        <xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/@href"/>
+			      </xsl:otherwise>
+	        </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="href_ext">
+          <xsl:call-template name="ext">
+            <xsl:with-param name="path"><xsl:value-of select="$path_href"/></xsl:with-param>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable name="path_href_noext">
+          <xsl:call-template name="path-noext">
+            <xsl:with-param name="path"><xsl:value-of select="$path_href"/></xsl:with-param>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable name="mimeType"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$idref]/@type"/></xsl:variable>
+        <xsl:variable name="href">
+          <xsl:choose>
+            <xsl:when test="$mimeType='text/xml'"><xsl:value-of select="$package_base"/><xsl:value-of select="$path_href_noext"/>.html</xsl:when>                        <xsl:when test="$mimeType='text/xml'"><xsl:value-of select="$package_base"/><xsl:value-of select="$path_href_noext"/>.html</xsl:when>
+            <xsl:when test="$mimeType='application/vnd-sun-xml-impress'"><xsl:value-of select="$package_base"/><xsl:value-of select="$path_href_noext"/>.html</xsl:when>
+            <xsl:when test="$mimeType='application/vnd-sun-xml-writer'"><xsl:value-of select="$package_base"/><xsl:value-of select="$path_href_noext"/>.html</xsl:when>                        
+          	<xsl:otherwise>
+          	  <xsl:value-of select="$package_base"/><xsl:value-of select="$path_href"/>
+          	</xsl:otherwise>
+         </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="element_name">item</xsl:variable>
+        
+        <xsl:element name="{$element_name}">
+          <xsl:attribute name="id"><xsl:value-of select="@identifier"/></xsl:attribute>
+          <xsl:attribute name="identifierref"><xsl:value-of select="$idref"/></xsl:attribute>
+          <xsl:attribute name="label"><xsl:value-of select="$title"/></xsl:attribute>   
+          <xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>
+          
+          <xsl:apply-templates select="ims:item"/>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="ims:item[not(@identifierref)]">
+    <xsl:variable name="title"><xsl:value-of select="ims:title"/></xsl:variable>
+    <xsl:variable name="element_name">itemGroup</xsl:variable>
+    
+    <xsl:element name="{$element_name}">
+      <xsl:attribute name="id"><xsl:value-of select="@identifier"/></xsl:attribute>
+      <xsl:attribute name="label"><xsl:value-of select="$title"/></xsl:attribute>
+      
+      <xsl:apply-templates select="ims:item"/>
+    </xsl:element>
+    
+  </xsl:template>
+  
+  <xsl:template match="adlcp:prerequisites">
+    <xsl:variable name="idref"><xsl:value-of select="."/></xsl:variable>
+    <xsl:variable name="title"><xsl:value-of select="//ims:item[@identifier=$idref]/ims:title"/></xsl:variable>
+    <xsl:variable name="resource_idref"><xsl:value-of select="//ims:item[@identifier=$idref]/@identifierref"/></xsl:variable>
+    <xsl:variable name="href"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$resource_idref]/ims:file/@href"/></xsl:variable>
+    
+    <xsl:element name="prerequisite">
+      <xsl:attribute name="label"><xsl:value-of select="$title"/></xsl:attribute>
+      <xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>
+    </xsl:element>
+  </xsl:template>
+  
+</xsl:stylesheet>

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/imsmanifest2tabs.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/imsmanifest2tabs.xsl	Thu Oct 14 17:48:14 2004
@@ -0,0 +1,98 @@
+<?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.
+-->
+<!--
+Stylesheet for generating site.xml from a IMS Manifest file.
+-->
+
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:ims="http://www.imsproject.org/xsd/imscp_rootv1p1p2"
+  xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2">
+  
+  <xsl:import href="pathutils.xsl"/>
+  <xsl:import href="repositoryUtils.xsl"/>
+
+  <xsl:output doctype-system="http://apache.org/forrest/dtd/tab-cocoon-v11.dtd"
+    doctype-public="-//APACHE//DTD Cocoon Documentation Tab V1.1//EN"/>
+
+  <xsl:template match="/">
+    <tabs software="MyProj"
+      title="MyProj"
+      copyright="foo">
+
+      <xsl:apply-templates select="ims:manifest"/>
+    </tabs>
+  </xsl:template>
+  
+  <xsl:template match="ims:manifest">
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+  <xsl:template match="ims:organizations">
+    <xsl:apply-templates select="ims:organization"/>
+  </xsl:template>
+  
+  <xsl:template match="ims:organization">
+    <xsl:variable name="title"><xsl:value-of select="./ims:title"/></xsl:variable>
+    <xsl:variable name="default_file_id"><xsl:value-of select=".//ims:item[@identifierref][1]/@identifierref"/></xsl:variable>
+    <xsl:variable name="repositoryCommand">
+      <xsl:call-template name="getRepositoryCommand">
+        <xsl:with-param name="path"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$default_file_id]/@href"/></xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="scoName">
+      <xsl:call-template name="getSCOName">
+        <xsl:with-param name="path"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$default_file_id]/@href"/></xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="full_path">
+      <xsl:choose>
+        <xsl:when test="$repositoryCommand='getSCO'">getSCO/<xsl:call-template name="getSCOName"><xsl:with-param name="path"><xsl:value-of select="//ims:resources/ims:resource[@identifier=$default_file_id]/@href"/></xsl:with-param></xsl:call-template></xsl:when>
+        <xsl:otherwise><xsl:value-of select="//ims:resources/ims:resource[@identifier=$default_file_id]/@href"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="href">
+      <xsl:call-template name="dirname-nz">
+        <xsl:with-param name="path"><xsl:value-of select="$full_path"/></xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="filename_noext">
+      <xsl:choose>
+        <xsl:when test="$repositoryCommand='getSCO'"><xsl:value-of select="$scoName"/>/index</xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="filename-noext">
+            <xsl:with-param name="path"><xsl:value-of select="$full_path"/></xsl:with-param>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    
+    <tab>
+      <xsl:attribute name="id"><xsl:value-of select="$title"/></xsl:attribute>
+      <xsl:attribute name="label"><xsl:value-of select="$title"/></xsl:attribute>
+      <xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>
+      <xsl:attribute name="indexfile">
+        <xsl:choose>
+          <xsl:when test="not($filename_noext='')"><xsl:value-of select="$filename_noext"/>.html</xsl:when>
+          <xsl:otherwise>index.html</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+      <xsl:apply-templates select="ims:item"/>
+    </tab>
+  </xsl:template>
+  
+</xsl:stylesheet>

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/pathutils.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/pathutils.xsl	Thu Oct 14 17:48:14 2004
@@ -0,0 +1,239 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--
+  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.
+-->
+<!--
+PathUtils.xsl
+
+A set of XSLT templates useful for parsing URI paths:
+
+dirname: return the directory part of a path
+filename: return the file part of a path
+ext: return the last extension of the filename in a path
+filename-noext: return the file part of a path without its last extension
+
+@author Jeff Turner <je...@apache.org>
+$Id: pathutils.xsl,v 1.1 2004/09/21 14:10:24 rgardler Exp $
+-->
+
+<!-- Returns the directory part of a path.  Equivalent to Unix 'dirname'.
+Examples:
+'' -> ''
+'foo/index.html' -> 'foo/'
+-->
+<xsl:template name="dirname">
+  <xsl:param name="path" />
+  <xsl:if test="contains($path, '/')">
+    <xsl:value-of select="concat(substring-before($path, '/'), '/')" />
+    <xsl:call-template name="dirname">
+      <xsl:with-param name="path"
+        select="substring-after($path, '/')" />
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<!-- Normalized (..'s eliminated) version of 'dirname' -->
+<xsl:template name="dirname-nz">
+  <xsl:param name="path" />
+  <xsl:call-template name="normalize">
+    <xsl:with-param name="path">
+      <xsl:call-template name="dirname">
+        <xsl:with-param name="path" select="$path" />
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+
+<!-- Returns the filename part of a path.  Equivalent to Unix 'basename'
+Examples:
+'index.html'  ->  'index.html' 
+'foo/bar/'  ->  '' 
+'foo/bar/index.html'  ->  'index.html' 
+-->
+<xsl:template name="filename">
+  <xsl:param name="path"/>
+  <xsl:choose>
+    <xsl:when test="contains($path, '/')">
+      <xsl:call-template name="filename">
+        <xsl:with-param name="path" select="substring-after($path, '/')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$path"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- Returns the last extension of a filename in a path.
+Examples:
+'index.html'  ->  '.html' 
+'index.dtdx.html'  ->  '.html' 
+'foo/bar/'  ->  '' 
+'foo/bar/index.html'  ->  '.html' 
+'foo/bar/index'  ->  '' 
+-->
+<xsl:template name="ext">
+  <xsl:param name="path"/>
+  <xsl:param name="subflag"/> <!-- Outermost call? -->
+  <xsl:choose>
+    <xsl:when test="contains($path, '.')">
+      <xsl:call-template name="ext">
+        <xsl:with-param name="path" select="substring-after($path, '.')"/>
+        <xsl:with-param name="subflag" select="'sub'"/>
+      </xsl:call-template>
+    </xsl:when>
+    <!-- Handle extension-less filenames by returning '' -->
+    <xsl:when test="not($subflag) and not(contains($path, '.'))">
+      <xsl:text/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="concat('.', $path)"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- Returns a filename of a path stripped of its last extension.
+Examples:
+'foo/bar/index.dtdx.html' -> 'index.dtdx'
+-->
+<xsl:template name="filename-noext">
+  <xsl:param name="path"/>
+  <xsl:variable name="filename">
+    <xsl:call-template name="filename">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="ext">
+    <xsl:call-template name="ext">
+      <xsl:with-param name="path" select="$filename"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:value-of select="substring($filename, 1, string-length($filename) - string-length($ext))"/>
+</xsl:template>
+
+<!-- Returns a path with the filename stripped of its last extension.
+Examples:
+'foo/bar/index.dtdx.html' -> 'foo/bar/index.dtdx'
+-->
+<xsl:template name="path-noext">
+  <xsl:param name="path"/>
+  <xsl:variable name="ext">
+    <xsl:call-template name="ext">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:value-of select="substring($path, 1, string-length($path) - string-length($ext))"/>
+</xsl:template>
+
+<!-- Normalized (..'s eliminated) version of 'path-noext' -->
+<xsl:template name="path-noext-nz">
+  <xsl:param name="path" />
+  <xsl:call-template name="normalize">
+    <xsl:with-param name="path">
+      <xsl:call-template name="path-noext">
+        <xsl:with-param name="path" select="$path" />
+      </xsl:call-template>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- Returns a path with any fragment identifier ('#...') stripped off
+Examples:
+'foo/bar/index.dtdx.html#blah' -> 'foo/bar/index.dtdx.html'
+-->
+<xsl:template name="path-nofrag">
+  <xsl:param name="path"/>
+  <xsl:if test="not(contains($path, '#'))">
+    <xsl:value-of select="$path"/>
+  </xsl:if>
+  <xsl:if test="contains($path, '#')">
+    <xsl:value-of select="substring-before($path, '#')"/>
+  </xsl:if>
+</xsl:template>
+
+
+
+<!-- Normalizes a path, converting '/' to '\' and eliminating ..'s
+Examples:
+'foo/bar/../baz/index.html' -> foo/baz/index.html'
+-->
+<xsl:template name="normalize">
+  <xsl:param name="path"/>
+  <xsl:variable name="path-" select="translate($path, '\', '/')"/>
+  <xsl:choose>
+    <xsl:when test="contains($path-, '/../')">
+
+      <xsl:variable name="pa" select="substring-before($path-, '/../')"/>
+      <xsl:variable name="th" select="substring-after($path-, '/../')"/>
+      <xsl:variable name="pa-">
+        <xsl:call-template name="dirname">
+          <xsl:with-param name="path" select="$pa"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="pa-th" select="concat($pa-, $th)"/>
+      <xsl:call-template name="normalize">
+        <xsl:with-param name="path" select="$pa-th"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:value-of select="$path-"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+</xsl:template>
+
+<!--
+Uncomment this to test.
+Usage: saxon pathutils.xsl pathutils.xsl path=foo/bar
+
+<xsl:param name="path" select="'/foo/bar/../baz/index.html'"/>
+<xsl:template match="/">
+  <xsl:message>
+    path           = <xsl:value-of select="$path"/>
+    normalize      = <xsl:call-template name="normalize">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    dirname        = <xsl:call-template name="dirname">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    dirname-nz     = <xsl:call-template name="dirname-nz">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    filename       = <xsl:call-template name="filename">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    ext            = <xsl:call-template name="ext">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    filename-noext = <xsl:call-template name="filename-noext">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    path-noext     = <xsl:call-template name="path-noext">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    path-noext-nz  = <xsl:call-template name="path-noext-nz">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+    path-nofrag    = <xsl:call-template name="path-nofrag">
+      <xsl:with-param name="path" select="$path"/>
+    </xsl:call-template>
+ 
+  </xsl:message>
+</xsl:template>
+-->
+
+</xsl:stylesheet>

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/repositoryUtils.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest/resources/stylesheets/repositoryUtils.xsl	Thu Oct 14 17:48:14 2004
@@ -0,0 +1,40 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!--
+  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.
+-->
+<!--
+RepositoryUtils.xsl
+
+A set of XSLT templates useful for parsing Burrokeet URI's
+
+-->
+
+<xsl:param name="cmdRepositoryGetSCO">http://repository.burrokeet.org/getSCO/</xsl:param>
+
+<!-- Return the burrokeet command in a path that includes one -->
+<xsl:template name="getRepositoryCommand">
+  <xsl:param name="path"/>
+  <xsl:if test="contains($path, $cmdRepositoryGetSCO)">getSCO</xsl:if>
+</xsl:template>
+
+<!-- return the name of the SCO too use -->
+<xsl:template name="getSCOName">
+  <xsl:param name="path"/>
+  <xsl:value-of select="substring-after($path, $cmdRepositoryGetSCO)"/>
+</xsl:template>
+
+
+</xsl:stylesheet>

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest/sitemap.xmap
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest/sitemap.xmap	Thu Oct 14 17:48:14 2004
@@ -0,0 +1,261 @@
+<?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.
+-->
+  <!-- ============================================================ -->
+  <!-- IMS Maniifest Plugin                                         -->
+  <!-- This plugin replaces the site.xml and tabs.xml file with     -->
+  <!-- an IMS Manifest file conforming to the IMS specifications    -->
+  <!-- for Content Packages.                                        -->
+  <!--                                                              -->
+  <!-- In the absence of an IMSManifest.xml file the plugin will    -->
+  <!-- fallback to using the standard site.xml and tabs.xml files.  -->
+  <!-- ============================================================ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:components>
+    <map:selectors>
+      <map:selector logger="sitemap.selector.config" name="config" src="org.apache.cocoon.selection.SimpleSelector" />
+    </map:selectors>
+  </map:components>
+  
+  <map:resources>
+    <map:resource name="skinit">
+        <map:select type="exists">
+          <map:when test="{project:skins-dir}{forrest:skin}/xslt/html/{type}.xsl">
+            <map:transform src="{project:skins-dir}{forrest:skin}/xslt/html/{type}.xsl">
+              <map:parameter name="notoc" value="{notoc}"/>
+              <!-- For backwards-compat with 0.2 - 0.4 skins -->
+              <map:parameter name="isfaq" value="{notoc}"/>
+              <map:parameter name="nopdf" value="{nopdf}"/>
+              <map:parameter name="path" value="{path}"/>
+              <map:parameter name="config-file" value="{project:skinconf}"/>
+            </map:transform>
+          </map:when>
+          <map:otherwise>
+            <map:transform src="{forrest:context}/skins/{forrest:skin}/xslt/html/{type}.xsl">
+              <map:parameter name="notoc" value="{notoc}"/>
+              <!-- For backwards-compat with 0.2 - 0.4 skins -->
+              <map:parameter name="isfaq" value="{notoc}"/>
+              <map:parameter name="nopdf" value="{nopdf}"/>
+              <map:parameter name="path" value="{path}"/>
+              <map:parameter name="config-file" value="{project:skinconf}"/>
+            </map:transform>
+          </map:otherwise>
+        </map:select>
+      <map:serialize/>
+    </map:resource>
+
+  </map:resources>
+
+    
+  <map:pipelines>
+  
+   <!-- ============================================================ -->
+   <!-- Linkmap.xmap overrides                                       -->
+   <!-- ============================================================ -->
+  
+    <map:pipeline>
+      <map:match pattern="abs-linkmap">
+        <map:select type="exists">
+          <map:when test="{project:content.xdocs}imsmanifest.xml">
+            <map:generate src="{project:content.xdocs}imsmanifest.xml" />
+            <map:transform src="{forrest:plugins}/IMSManifest/resources/stylesheets/imsmanifest2site.xsl"/>
+          </map:when>
+          <map:when test="{project:content.xdocs}site.xml">
+            <map:generate src="{project:content.xdocs}site.xml" />
+          </map:when>
+        </map:select>
+        <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
+        <map:serialize type="xml" />
+      </map:match>
+
+    </map:pipeline>
+    
+   <!-- ============================================================ -->
+   <!-- tabs.xmap overrides                                          -->
+   <!-- ============================================================ -->
+  
+    <map:pipeline >
+      <map:match pattern="**tab-*.html">
+        <map:select type="exists">
+          <map:when test="{project:content.xdocs}imsmanifest.xml">
+            <map:generate src="{project:content.xdocs}imsmanifest.xml" />
+            <map:transform src="{forrest:plugins}/IMSManifest/resources/stylesheets/imsmanifest2tabs.xsl"/>
+          </map:when>
+          <map:when test="{project:content.xdocs}tabs.xml">
+            <map:generate src="{project:content.xdocs}tabs.xml" />
+          </map:when>
+        </map:select>
+        <map:transform type="linkrewriter" src="cocoon:/{1}linkmap-{2}.html"/>
+        <map:call resource="skinit">
+          <map:parameter name="type" value="tab2menu"/>
+          <map:parameter name="path" value="{1}{2}.html"/>
+        </map:call>
+      </map:match>      
+    </map:pipeline>
+ 
+    
+    <!-- ============================================================ -->
+    <!-- menu.xmap overrides                                          -->
+    <!-- ============================================================ -->
+    
+    <map:pipeline internal-only="false">
+
+      <map:match pattern="abs-menulinks">
+        <map:select type="exists">
+          <map:when test="{project:content.xdocs}imsmanifest.xml">
+            <map:generate src="{project:content.xdocs}imsmanifest.xml" />
+            <map:transform src="{forrest:plugins}/IMSManifest/resources/stylesheets/imsmanifest2site.xsl"/>
+            <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
+            <map:transform src="{forrest:stylesheets}/site2site-normalizetabs.xsl" />
+            <map:serialize type="xml"/>
+          </map:when>
+          <map:when test="{project:content.xdocs}site.xml">
+            <map:generate src="{project:content.xdocs}site.xml" />
+            <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
+            <map:transform src="{forrest:stylesheets}/site2site-normalizetabs.xsl" />
+            <map:transform src="{forrest:stylesheets}/normalizehrefs.xsl"/>
+            <map:serialize type="xml"/>
+          </map:when>
+        </map:select>
+      </map:match>
+
+      <map:match pattern="**menulinks-*">
+        
+        <map:select type="exists">
+          <map:when test="{project:content.xdocs}imsmanifest.xml">
+            <map:generate src="{project:content.xdocs}imsmanifest.xml" />
+            <map:transform src="{forrest:plugins}/IMSManifest/resources/stylesheets/imsmanifest2site.xsl"/>
+            <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
+          </map:when>
+          <map:when test="{project:content.xdocs}site.xml">
+            <map:generate src="{project:content.xdocs}site.xml" />
+            <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
+          </map:when>
+        </map:select>
+
+        <map:select type="config">
+          <map:parameter name="value" value="{defaults:menu-scheme}"/>
+
+          <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>
+          </map:when>
+
+        </map:select>
+
+        <map:transform src="{forrest:stylesheets}/relativize-linkmap.xsl">
+          <map:parameter name="path" value="{1}{2}" />
+        </map:transform>
+        <map:serialize type="xml" />
+      </map:match>
+    </map:pipeline>
+     
+    <!-- ============================================================ -->
+    <!-- Repository Matchers                                          -->
+    <!-- ============================================================ -->
+    
+    <map:pipeline>
+      <map:match pattern="getSCO/*/**.xml">
+        <!-- FIXME: remove hard coded path to repository (project.repository.url) -->
+        <!-- FIXME: is there any way of preventing the need to copy this stuff manually when it changes in the forrest.xmap file in Forrest -->
+        <map:select type="exists">
+          <map:when test="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.cwiki">
+            <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
+              <map:generate type="text2xml" src="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.cwiki" />
+              
+              <map:transform type="lexer"   src="cocoon:/wiki.xlex"/>
+              <map:transform type="parser"  src="cocoon:/wiki.xgrm"/>
+
+                <map:transform type="xsltc" src="{forrest:home}/context/resources/chaperon/stylesheets/wiki2xdoc.xsl">
+                <map:parameter name="name" value="{2}" />
+              </map:transform>
+              <map:serialize/>
+            </map:match>
+          </map:when>
+
+          <map:when test="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.txt">
+            <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
+              <map:generate type="text2xml" src="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.txt" />
+              <map:transform src="{forrest:stylesheets}/text2document.xsl">
+                <map:parameter name="filename" value="{2}" />
+              </map:transform>
+              <map:serialize/>
+            </map:match>
+          </map:when>
+
+          <map:when test="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxw">
+            <map:aggregate element="openOffice">
+              <!-- FIXME: on windows we need three / after the protocol, on LInux we need 2 -->
+              <map:part src="jar:file:///d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxw!/meta.xml"/>
+              <map:part src="jar:file:///d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxw!/styles.xml"/>
+              <map:part src="jar:file:///d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxw!/content.xml"/>
+            </map:aggregate>
+            <map:select type="exists">
+              <map:when test="{project:resources.stylesheets}/openoffice-writer2forrest.xsl">
+                <map:transform src="{project:resources.stylesheets}/openoffice-writer2forrest.xsl">
+                  <map:parameter name="filename" value="{2}" />
+                  <map:parameter name="extension" value="sxw" />
+                </map:transform>
+              </map:when>
+              <map:otherwise>
+                <map:transform src="{forrest:stylesheets}/openoffice-writer2forrest.xsl">
+                  <map:parameter name="filename" value="{2}" />
+                  <map:parameter name="extension" value="sxw" />
+                </map:transform>
+              </map:otherwise>
+            </map:select>
+            <map:serialize/>
+          </map:when>     
+          
+          <map:when test="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxi">
+            <map:aggregate element="openOffice">
+              <!-- FIXME: on windows we need three / after the protocol, on LInux we need 2 -->
+              <map:part src="jar:file:///d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxi!/meta.xml"/>
+              <map:part src="jar:file:///d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxi!/styles.xml"/>
+              <map:part src="jar:file:///d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.sxi!/content.xml"/>
+            </map:aggregate>
+            <map:select type="exists">
+              <map:when test="{project:resources.stylesheets}/openoffice-impress2forrest.xsl">
+                <map:transform src="{project:resources.stylesheets}/openoffice-impress2forrest.xsl">
+                  <map:parameter name="filename" value="{2}" />
+                  <map:parameter name="extension" value="sxi" />
+                </map:transform>
+              </map:when>
+              <map:otherwise>
+                <map:transform src="{forrest:stylesheets}/openoffice-impress2forrest.xsl">
+                  <map:parameter name="filename" value="{2}" />
+                  <map:parameter name="extension" value="sxi" />
+                </map:transform>
+              </map:otherwise>
+            </map:select>
+            <map:serialize/>
+          </map:when>
+          
+          <map:otherwise>
+            <map:generate src="d:/projects/burrokeet/repositoryData/{1}/src/documentation/content/xdocs/{2}.xml"/>
+            <map:serialize/>
+          </map:otherwise>
+        </map:select>
+      </map:match>
+    </map:pipeline>
+    
+  </map:pipelines>    
+</map:sitemap>