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/09/28 21:31:01 UTC

svn commit: rev 47415 - in forrest/branches/sitemap-plugins: plugins plugins/IMSManifest.bak plugins/IMSManifest.bak/resources plugins/IMSManifest.bak/resources/stylesheets src/core src/core/context src/core/context/WEB-INF src/core/targets src/core/var src/documentation/content/xdocs src/documentation/content/xdocs/docs

Author: rgardler
Date: Tue Sep 28 12:30:59 2004
New Revision: 47415

Added:
   forrest/branches/sitemap-plugins/plugins/
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/imsmanifest2site.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/imsmanifest2tabs.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/pathutils.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/repositoryUtils.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/sitemap.xmap   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/plugins-1.xml   (contents, props changed)
   forrest/branches/sitemap-plugins/plugins/sitemap.xmap   (contents, props changed)
   forrest/branches/sitemap-plugins/src/core/targets/plugins.xml   (contents, props changed)
   forrest/branches/sitemap-plugins/src/core/var/pluginlist2echo.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/src/core/var/pluginlist2echo.xsl~
   forrest/branches/sitemap-plugins/src/core/var/pluginlist2fetch.xsl   (contents, props changed)
   forrest/branches/sitemap-plugins/src/documentation/content/xdocs/docs/plugins.xml   (contents, props changed)
Modified:
   forrest/branches/sitemap-plugins/src/core/context/WEB-INF/cocoon.xconf
   forrest/branches/sitemap-plugins/src/core/context/default-forrest.properties
   forrest/branches/sitemap-plugins/src/core/context/sitemap.xmap
   forrest/branches/sitemap-plugins/src/core/forrest.build.xml
   forrest/branches/sitemap-plugins/src/documentation/content/xdocs/site.xml
Log:
Sitemap plugin capability (last stage of install not yet automated)

Added: forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/imsmanifest2site.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/imsmanifest2site.xsl	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+
+<!--
+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="repositoryCommand">
+      <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="$repositoryCommand='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 -->
+        <xsl:variable name="sco">file:///D:/projects/burrokeet/repositoryData/<xsl:value-of select="$scoName"/>/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.bak/resources/stylesheets/imsmanifest2tabs.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/imsmanifest2tabs.xsl	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+
+<!--
+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.bak/resources/stylesheets/pathutils.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/pathutils.xsl	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,224 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--
+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.bak/resources/stylesheets/repositoryUtils.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/resources/stylesheets/repositoryUtils.xsl	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,24 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--
+PathUtils.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.bak/sitemap.xmap
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/IMSManifest.bak/sitemap.xmap	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,172 @@
+<?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>
+    
+  </map:pipelines>    
+</map:sitemap>

Added: forrest/branches/sitemap-plugins/plugins/plugins-1.xml
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/plugins-1.xml	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,39 @@
+<?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.
+-->
+<!DOCTYPE plugins [
+  <!ENTITY % links.att 'name CDATA #REQUIRED'>
+  <!ENTITY % link.att 'name CDATA #REQUIRED href CDATA #REQUIRED'>
+  <!ELEMENT plugins (plugin*)>
+  <!ELEMENT plugin (description)>
+  <!ATTLIST plugin name CDATA #REQUIRED
+                 url  CDATA #REQUIRED
+                 author CDATA #REQUIRED
+                 website CDATA #IMPLIED>
+  <!ELEMENT description (#PCDATA)>
+  ]>
+  
+<plugins>
+  <plugin name="IMSManifest"
+        author="Ross Gardler"
+        website="http://www.burrakeet.org"
+        url="http://www.apache.org/~rgardler/testingGround/forrestPlugins/">
+    <description>
+      Use an IMS Manifest file to manage site structure. Generates site.xml and
+      tabs.xml from an imsmanifest.xml file when one is available.
+    </description>
+  </plugin>
+</plugins> 
\ No newline at end of file

Added: forrest/branches/sitemap-plugins/plugins/sitemap.xmap
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/plugins/sitemap.xmap	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,39 @@
+<?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.
+-->
+
+  <!-- ============================================================ -->
+  <!-- Plugin Sitemap                                               -->
+  <!--                                                              -->
+  <!-- This sitemap includes all enabled plugins in the generation  -->
+  <!-- process. It is mounted from the main Forrest sitemap after   -->
+  <!-- any project specific sitemap but before the default Forrest  -->
+  <!-- matchers. This enables plugins to override or extend default -->
+  <!-- Forrest behaviour whilst individual projects can override    -->
+  <!-- or extend the plugins behaviour.                             -->
+  <!-- ============================================================ -->
+  
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:pipelines>
+    <map:pipeline internal-only="false">
+       <map:mount uri-prefix="" 
+                  src="{forrest:plugins}/IMSManifest/sitemap.xmap" 
+                  check-reload="yes" 
+                  pass-through="true"/>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Modified: forrest/branches/sitemap-plugins/src/core/context/WEB-INF/cocoon.xconf
==============================================================================
--- forrest/branches/sitemap-plugins/src/core/context/WEB-INF/cocoon.xconf	(original)
+++ forrest/branches/sitemap-plugins/src/core/context/WEB-INF/cocoon.xconf	Tue Sep 28 12:30:59 2004
@@ -113,6 +113,7 @@
         <context>@context.home@</context>        
         <skins-dir>@context.home@/skins/</skins-dir>
         <stylesheets>@context.home@/resources/stylesheets</stylesheets>
+        <plugins>@forrest.home@/../../plugins</plugins>
       </values>
     </component-instance>
 
@@ -120,6 +121,7 @@
       <values>
         <skin>@project.skin@</skin>
         <sitemap>@project.home@/@project.sitemap@</sitemap>
+        <pluginmap>@project.home@/@project.pluginmap@</pluginmap>
         <status>@project.home@/@project.status@</status>
         <skinconf>@project.home@/@project.skinconf@</skinconf>        
         <doc>@project.home@/@project.content-dir@/</doc>

Modified: forrest/branches/sitemap-plugins/src/core/context/default-forrest.properties
==============================================================================
--- forrest/branches/sitemap-plugins/src/core/context/default-forrest.properties	(original)
+++ forrest/branches/sitemap-plugins/src/core/context/default-forrest.properties	Tue Sep 28 12:30:59 2004
@@ -28,6 +28,7 @@
 
 # comma separated list, file:// is supported
 forrest.skins.descriptors=http://forrest.apache.org/skins/skins.xml
+forrest.plugins.descriptors=http://www.apache.org/~rgardler/testingGround/forrestPlugins/plugins.xml
 
 ##############
 # behavioural properties

Modified: forrest/branches/sitemap-plugins/src/core/context/sitemap.xmap
==============================================================================
--- forrest/branches/sitemap-plugins/src/core/context/sitemap.xmap	(original)
+++ forrest/branches/sitemap-plugins/src/core/context/sitemap.xmap	Tue Sep 28 12:30:59 2004
@@ -345,7 +345,14 @@
              </map:when>  
            </map:select>
       </map:pipeline>
-        
+    
+      <map:pipeline internal-only="false">
+         <map:mount uri-prefix="" 
+                    src="{forrest:plugins}/sitemap.xmap" 
+                    check-reload="yes" 
+                    pass-through="true"/>
+      </map:pipeline>
+       
       <map:pipeline internal-only="false">
          <map:match pattern="skinconf.xml">
            <map:generate src="{project:skinconf}" />

Modified: forrest/branches/sitemap-plugins/src/core/forrest.build.xml
==============================================================================
--- forrest/branches/sitemap-plugins/src/core/forrest.build.xml	(original)
+++ forrest/branches/sitemap-plugins/src/core/forrest.build.xml	Tue Sep 28 12:30:59 2004
@@ -44,6 +44,7 @@
   <import file="targets/webapp.xml"/>
   <import file="targets/site.xml"/>
   <import file="targets/skins.xml"/>
+  <import file="targets/plugins.xml"/>
   <import file="targets/context.xml"/>
  
   <description>
@@ -97,7 +98,8 @@
 
     <!-- people should use forrest.properties to override following defaults  -->
     <property name="forrest.home"        location="." />
-    <property name="forrest.skins-dir"   location="${forrest.home}/context/skins"/>   
+    <property name="forrest.skins-dir"   location="${forrest.home}/context/skins"/>  
+    <property name="forrest.plugins-dir"   location="${forrest.home}/../../plugins"/>   
     <property name="project.site-dir"    location="${project.build-dir}/site"    />
     <property name="project.war"         location="${project.build-dir}/${project.name}.war" />
     <property name="project.webapp"      location="${project.build-dir}/webapp" />

Added: forrest/branches/sitemap-plugins/src/core/targets/plugins.xml
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/src/core/targets/plugins.xml	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,121 @@
+<?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.
+-->
+
+<project basedir="." name="plugins">
+   <!-- public targets -->     
+     
+    <target name="available-plugins"
+          depends="init-props, plugin-unavailable, fetch-plugins-descriptors"
+          description="What plugins are available?">
+    <for param="plugin-descriptor-file">
+      <path>
+        <fileset dir="${forrest.plugins-dir}" includes="plugins-*.xml"/>
+      </path>
+      <sequential>
+        <xslt in="@{plugin-descriptor-file}" 
+          out="${project.temp-dir}/pluginlist2echobuild.xml"
+          style="${forrest.home}/var/pluginlist2echo.xsl"/>  
+    <ant antfile="${project.temp-dir}/pluginlist2echobuild.xml"/>
+      </sequential>
+    </for>
+  </target>  
+  
+  <target name="get-plugin-name"
+    description="Ask the user for the name of the plugin they wish to install">
+    <input message="Enter the name of the plugin you wish to install: " 
+      addproperty="plugin.name"/>
+  </target>
+
+  <target name="install-plugin" 
+          depends = "get-plugin-name, init-plugins"
+          description="Install the needed plugin from the remote repository"/>
+          
+  <!-- private -->        
+                
+  <target name="init-plugins" depends="init-props, check-plugin, fetch-plugin, unpack-plugins"/>   
+
+  <target name="plugin-unavailable">   
+    <property name="plugin.unavailable" value="true"/>
+  </target>  
+  
+  <target name="check-plugin">   
+    <condition property="plugin.unavailable">
+      <and>
+        <not>
+          <available type="dir" file="${forrest.plugins-dir}/${plugin.name}"/>
+        </not>
+        <not>
+          <available type="file" file="${forrest.plugins-dir}/${plugin.name}.zip"/>
+        </not>
+      </and>
+    </condition>
+  </target>  
+            
+  <target name="unpack-plugins"
+          depends="init-props">
+     <unzip dest="${forrest.plugins-dir}/">
+       <fileset dir="${forrest.plugins-dir}/">
+          <include name="*.zip"/>
+        </fileset>
+     </unzip>       
+     <delete>
+        <fileset dir="${forrest.plugins-dir}/">
+          <include name="*.zip"/>
+        </fileset>
+     </delete>
+  </target>  
+
+  <target name="fetch-plugins-descriptors" if="plugin.unavailable">
+    <delete>
+      <fileset dir="${forrest.plugins-dir}" includes="plugins-*.xml"/>
+    </delete>
+  
+    <var name="plugin-counter" value="1"/>
+    <for list="${forrest.plugins.descriptors}" param="url">
+      <sequential>
+        <echo>fetching descriptor: @{url}</echo>
+        <get src="@{url}" 
+           dest="${forrest.plugins-dir}/plugins-${plugin-counter}.xml"
+           verbose="true" usetimestamp="true" ignoreerrors="true"/>
+        <math result="plugin-counter" operand1="${plugin-counter}" operation="+" operand2="1" datatype="int"/>
+      </sequential>
+    </for>
+  </target>  
+  
+  <target name="fetch-plugin" 
+          if = "plugin.unavailable"
+          depends="init-props, fetch-plugins-descriptors">
+    <for param="plugin-descriptor-file">
+      <path>
+        <fileset dir="${forrest.plugins-dir}" includes="plugins-*.xml"/>
+      </path>
+      <sequential>
+        <xslt in="@{plugin-descriptor-file}" 
+          out="${project.temp-dir}/pluginlist2fetchbuild.xml"
+          style="${forrest.home}/var/pluginlist2fetch.xsl"
+          force="true">
+          <param name="plugin-name" expression="${plugin.name}"/>  
+          <param name="plugin-dir" expression="${forrest.plugins-dir}/"/>      
+          <param name="forrest-version" expression="${version}"/>   
+       </xslt>  
+       <ant antfile="${project.temp-dir}/pluginlist2fetchbuild.xml"/>
+      </sequential>
+    </for>
+    <echo>FIXME: Still need to enable the plugin by adding snippet to plugins.xml</echo>
+  </target>    
+  
+</project>

Added: forrest/branches/sitemap-plugins/src/core/var/pluginlist2echo.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/src/core/var/pluginlist2echo.xsl	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,43 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+	<xsl:template match="plugins">
+      <project default="echoplugins">
+      	<target name="echoplugins">
+      	<echo>Available plugins:
+Forrest provides basic functionlaity for creating documentation in various
+formats froma range of source formats. However, additional functionlaity
+can be provided through plugins.
+
+Plugins may be maintained by other people and be available from
+outside the Forrest distribution. The list below details all known plugins.
+</echo>
+  	    <xsl:apply-templates select="plugin" />
+	    </target>
+	  </project>
+	</xsl:template>
+	
+	<xsl:template match="plugin">
+<echo>
+* <xsl:value-of select="@name"/> - <xsl:value-of select="normalize-space(description)"/>
+  - author: <xsl:value-of select="@author"/>
+  - website: <xsl:value-of select="@website"/> 	    
+</echo>
+	</xsl:template>	
+	
+</xsl:stylesheet>

Added: forrest/branches/sitemap-plugins/src/core/var/pluginlist2echo.xsl~
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/src/core/var/pluginlist2echo.xsl~	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,43 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+	<xsl:template match="pluginss">
+      <project default="echoplugins">
+      	<target name="echoplugins">
+      	<echo>Available plugins:
+Forrest provides basic functionlaity for creating documentation in various
+formats froma range of source formats. However, additional functionlaity
+can be provided through plugins.
+
+Plugins may be maintained by other people and be available from
+outside the Forrest distribution. The list below details all known plugins.
+</echo>
+  	    <xsl:apply-templates select="plugin" />
+	    </target>
+	  </project>
+	</xsl:template>
+	
+	<xsl:template match="plugin">
+<echo>
+* <xsl:value-of select="@name"/> - <xsl:value-of select="normalize-space(description)"/>
+  - author: <xsl:value-of select="@author"/>
+  - website: <xsl:value-of select="@website"/> 	    
+</echo>
+	</xsl:template>	
+	
+</xsl:stylesheet>

Added: forrest/branches/sitemap-plugins/src/core/var/pluginlist2fetch.xsl
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/src/core/var/pluginlist2fetch.xsl	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,69 @@
+<?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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+   <xsl:output method="xml" indent="yes" />
+
+   <xsl:param name="plugin-name" />
+   <xsl:param name="plugin-dir"/>
+   <xsl:param name="forrest-version" />
+
+   <xsl:template match="plugins">
+      <project default="fetchplugin">
+      
+         <target name="fetchplugin" depends="fetch-versioned-plugin, fetch-unversioned-plugin, final-check"/>
+
+         <target name="fetch-versioned-plugin">
+            <echo>Trying to get "<xsl:value-of select="$plugin-name" />" plugin version 
+                  <xsl:value-of select="$forrest-version" />...</echo>
+            <get verbose="true" usetimestamp="true" ignoreerrors="true">
+               <xsl:attribute name="src"><xsl:value-of select="plugin[@name=$plugin-name]/@url" /><xsl:value-of select="$plugin-name" />-<xsl:value-of select="$forrest-version" />.zip</xsl:attribute>
+               <xsl:attribute name="dest"><xsl:value-of select="$plugin-dir"/><xsl:value-of select="$plugin-name" />.zip</xsl:attribute>
+            </get>
+            <available property="versioned-plugin.present">
+               <xsl:attribute name="file"><xsl:value-of select="$plugin-dir"/><xsl:value-of select="$plugin-name" />.zip</xsl:attribute>
+            </available>
+         </target>
+
+         <target name="fetch-unversioned-plugin" unless="versioned-plugin.present">
+            <echo>Versioned plugin unavailable, trying to get versionless plugin...</echo>
+            <get verbose="true" usetimestamp="true" ignoreerrors="true">
+               <xsl:attribute name="src"><xsl:value-of select="plugin[@name=$plugin-name]/@url" /><xsl:value-of select="$plugin-name" />.zip</xsl:attribute>
+               <xsl:attribute name="dest"><xsl:value-of select="$plugin-dir"/><xsl:value-of select="$plugin-name" />.zip</xsl:attribute>
+            </get>
+         </target>
+
+         <target name="final-check">
+            <available property="plugin.present">
+               <xsl:attribute name="file"><xsl:value-of select="$plugin-dir"/><xsl:value-of select="$plugin-name" />.zip</xsl:attribute>
+            </available>
+            <fail unless="plugin.present">
+              Unable to download the 
+              "<xsl:value-of select="$plugin-name" />" plugin from 
+              <xsl:value-of select="plugin[@name=$plugin-name]/@url" />. 
+              In case the reason is the network connection, you can try 
+              installing the package manually by placing the file in the 
+              plugins directory.</fail>
+            <echo>Plugin "<xsl:value-of select="$plugin-name" />" correctly installed.</echo>
+         </target>
+      </project>
+   </xsl:template>
+
+   <xsl:template match="plugin">
+   </xsl:template>
+   
+</xsl:stylesheet>
+

Added: forrest/branches/sitemap-plugins/src/documentation/content/xdocs/docs/plugins.xml
==============================================================================
--- (empty file)
+++ forrest/branches/sitemap-plugins/src/documentation/content/xdocs/docs/plugins.xml	Tue Sep 28 12:30:59 2004
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+  <header>
+    <title>Extending Forrest with Plugins</title>
+  </header>
+
+  <body>
+    <section id="overview">
+      <title>Overview</title>
+      <p>Forrest provides the core functionality for generating documentation
+      in various output formats from a range of input formats. However, it
+      does not end there. Forrest can be extended through the addition of
+      plugins. This document serves as an introduction to the Forrest
+      plugin mechanism.</p>
+      
+    </section>
+    
+    <section>
+      <title>What is a Forrest Plugin?</title>
+
+      <p>A Forrest plugin is a set of resources and configuration files that 
+      extend the functionality of Forrest. They will typically consist of a 
+      sitemap, zero or more stylesheets and zero or more schema's.</p>
+
+      <p>The plugins sitemap is mounted by Forrests sitemap after the project 
+      specific sitemap but before the Forrest default matchers. This allows 
+      individual projects to override/extend functionality provided in either 
+      a plugin or Forrest whilst plugins are only able to override/extend the 
+      default Forrest behaviour.</p>
+
+      <p>Forrest is easily extensible through the existing sitemap.xmap files, 
+      however the more features we add the more complex the sitemap becomes. It 
+      is already quite difficult to understand the default sitemap.xmap files, 
+      and this will only get worse as new features find their way into the 
+      core.</p>
+
+      <p>By adopting a plugin model we can keep the core of Forrest tightly 
+      focused on the basic functionality whilst still facilitating extensions 
+      to suit individual projects needs.</p>
+    
+      <section>
+        <title>An Example Plugin</title>
+  
+        <p>In order to fully understand the applicability of Forrest Plugins we 
+        will consider an extension to the way in which Forrest defines the 
+        structure of the site. By default Forrest uses a site.xml file to 
+        define navigation through the site and a tabs.xml file to define the 
+        tabs across the top of the page. But what if we want to use a different
+        file to describe site structure? For example, what if we want to use an
+        IMS Manifest file from the SCORM content package standards 
+        (http://www.adlnet.org/).</p>
+  
+        <p>An IMS Manifest file describes the structure of a site. It is also 
+        possible to define a set of rules for extracting tab information from 
+        such a file. Consequently, it is possible to use an IMSManifest file to 
+        create Forrests site.xml and tabs.xml files. The advantage would be that
+        we can then use SCORM compliant content objects within Forrest.</p>
+  
+        <p>Unfortunately, IMS Manifests are much more complex than site.xml and 
+        tabs.xml files. Therefore, not all users will want to use them. Adding 
+        the functionality as an optional plugin seems to be the ideal 
+        solution.</p>
+      </section>
+    </section>
+
+    <section>
+      <title>What Does a Forrest Plugin Look Like?</title>
+
+      <p>Plugins will need to conform to a specified directory structure. 
+      This mirrors the default forrest directory structure:</p>
+
+<source>
+[plugin_name]
+  |
+  |-- config files (xmap, skinconf etc.)
+  |
+  |-- resources
+      |
+      |-- schema
+      |   |
+      |   |-- catalog.xcat
+      |   |
+      |   |--DTD (dtd's etc.)
+      |
+      |-- stylesheets (xsl's etc.)
+</source>
+  
+    <section>
+      <title>The IMS Manifest Plugin</title>
+
+      <p>If we consider the IMS Manifest Plugin described above we see that we
+      will need the following files and directory structure:</p>
+
+     
+<source>
+IMSManifest
+  |
+  |-- sitemap.xmap
+  |
+  |-- resources
+      |
+      |-- stylesheets
+                    |
+                    |- imsmanifest2site.xsl
+                    |- imsmanifest2tabs.xsl
+                    |- pathutils.xsl
+                    |- repositoryUtils.xsl
+</source>
+
+      <p>The sitemap.xmap file will override the default behaviour for the 
+      navigation generation matchers in Forrest, for example, it contains 
+      a matcher as follows:</p>
+
+<source><![CDATA[
+<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>
+]]></source>
+
+      <note>Note that this matcher will default to the behaviour provided by 
+      Forrest if there is no imsmanifest.xml file present in the project.
+      At present it is necessary to copy this default behaviour from the original
+      Forrest *.xmap files. We hope to improve on this in the future.</note>
+    </section>
+  </section>
+
+  <section>
+    <title>How is a Plugin Installed?</title>
+
+    <p>To install a plugin the user will run the command 
+    <code>forrest install-plugin'</code>. This will ask the user for the name of
+    the plugin they wish to install and search known plugin repositories for the 
+    plugin package. If found the plugin package will be downloaded and 
+    extracted into the plugins directory of Forrest and an entry will be made 
+    in <code>src/plugins/stitemap.xmap</code>. For example, installing the 
+    IMSManifest plugin described above will result in the following entry 
+    being added to the plugin sitemap:</p>
+
+<source><![CDATA[
+    <map:pipeline internal-only="false">
+       <map:mount uri-prefix=""
+                  src="{forrest:plugins}/IMSManifest/sitemap.xmap"
+                  check-reload="yes"
+                  pass-through="true"/>
+    </map:pipeline>
+]]></source>
+
+    <p>Installed plugins are managed by the file 
+    FORREST_INSTALL_DIR/plugings/sitemap.xmap. This file is mounted by main 
+    Forrest sitemap with the following code:</p>
+
+<source><![CDATA[
+      <map:pipeline internal-only="false">
+         <map:mount uri-prefix=""
+                    src="{forrest:plugins}/sitemap.xmap"
+                    check-reload="yes"
+                    pass-through="true"/>
+      </map:pipeline>
+]]></source>
+    
+    <note>The plugin sitemap.xmap file is automatically managed by Forrest, the 
+    end user need never edit this file.</note>
+  </section>
+  
+  <section>
+    <title>What plugins are available?</title>
+    <p>You can run the command <code>forrest available-plugins</code> to get
+    a list of the known plugins for Forrest.</p>
+    
+    <p>If you would like to have your own plugin added to this list then
+    contact the <a href="site:mail-lists">developer mailing list</a>.</p>
+  </section>
+  </body>
+</document>

Modified: forrest/branches/sitemap-plugins/src/documentation/content/xdocs/site.xml
==============================================================================
--- forrest/branches/sitemap-plugins/src/documentation/content/xdocs/site.xml	(original)
+++ forrest/branches/sitemap-plugins/src/documentation/content/xdocs/site.xml	Tue Sep 28 12:30:59 2004
@@ -48,6 +48,7 @@
     <searching label="Searching" href="searching.html"/>
     <skins label="Default Skins" href="skins.html"/>
     <skin-package label="Skin Packages" href="skin-package.html"/>
+    <plugins label="Plugins" href="plugins.html"/>
     <!--
     <quick-xml label="XML Guide" href="quick-xml.html"/>
     -->