You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/10/30 21:50:10 UTC

svn commit: r590448 - in /lenya/sandbox/modules/forrest: ./ config/ config/cocoon-xconf/ java/ java/src/ java/src/org/ java/src/org/apache/ java/src/org/apache/lenya/ java/src/org/apache/lenya/modules/ java/src/org/apache/lenya/modules/forrest/ java/te...

Author: andreas
Date: Tue Oct 30 13:50:08 2007
New Revision: 590448

URL: http://svn.apache.org/viewvc?rev=590448&view=rev
Log:
Added first draft of forrest module

Added:
    lenya/sandbox/modules/forrest/
    lenya/sandbox/modules/forrest/config/
    lenya/sandbox/modules/forrest/config/cocoon-xconf/
    lenya/sandbox/modules/forrest/config/cocoon-xconf/resourcetype-forrestDocument20.xconf
    lenya/sandbox/modules/forrest/config/module.xml
    lenya/sandbox/modules/forrest/java/
    lenya/sandbox/modules/forrest/java/src/
    lenya/sandbox/modules/forrest/java/src/org/
    lenya/sandbox/modules/forrest/java/src/org/apache/
    lenya/sandbox/modules/forrest/java/src/org/apache/lenya/
    lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/
    lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/
    lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java
    lenya/sandbox/modules/forrest/java/test/
    lenya/sandbox/modules/forrest/java/test/org/
    lenya/sandbox/modules/forrest/java/test/org/apache/
    lenya/sandbox/modules/forrest/java/test/org/apache/lenya/
    lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/
    lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/
    lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java
    lenya/sandbox/modules/forrest/lenya/
    lenya/sandbox/modules/forrest/lenya/modules/
    lenya/sandbox/modules/forrest/lenya/modules/sitetree/
    lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/
    lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/navigation/
    lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/navigation/menu.xsl
    lenya/sandbox/modules/forrest/resources/
    lenya/sandbox/modules/forrest/resources/samples/
    lenya/sandbox/modules/forrest/resources/samples/forrestDocument20.xml
    lenya/sandbox/modules/forrest/resources/schemas/
    lenya/sandbox/modules/forrest/resources/schemas/document-v20.mod.rng
    lenya/sandbox/modules/forrest/resources/schemas/document-v20.rng
    lenya/sandbox/modules/forrest/sitemap.xmap
    lenya/sandbox/modules/forrest/xslt/
    lenya/sandbox/modules/forrest/xslt/forrest2index.xsl
    lenya/sandbox/modules/forrest/xslt/forrest2xhtml.xsl
    lenya/sandbox/modules/forrest/xslt/helper-object.xsl

Added: lenya/sandbox/modules/forrest/config/cocoon-xconf/resourcetype-forrestDocument20.xconf
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/config/cocoon-xconf/resourcetype-forrestDocument20.xconf?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/config/cocoon-xconf/resourcetype-forrestDocument20.xconf (added)
+++ lenya/sandbox/modules/forrest/config/cocoon-xconf/resourcetype-forrestDocument20.xconf Tue Oct 30 13:50:08 2007
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
+
+<xconf xpath="/cocoon/resource-types" unless="/cocoon/resource-types/component-instance[@name = 'forrestDocument20']">
+  
+  <component-instance name="forrestDocument20"
+    logger="lenya.resourcetypes.forrestDocument20"
+    class="org.apache.lenya.cms.publication.ResourceTypeImpl">
+    <schema 
+      namespace="http://relaxng.org/ns/structure/0.9"
+      uri="fallback://lenya/modules/forrest/resources/schemas/document-v20.rng"/>
+    
+    <!-- Default time in seconds until the resource-type has expired -->  
+    <expires seconds="3600" />
+    
+    <sample 
+      mime-type="application/xml" 
+      uri="fallback://lenya/modules/forrest/resources/samples/forrestDocument20.xml"
+    />
+    
+    <link-attribute xpath="//*/@href"/>
+    <link-attribute xpath="//*/@src"/>
+    <format name="xhtml" uri="cocoon://modules/forrest/xhtml.xml"/>
+    <format name="webdavGET" uri="cocoon://modules/forrest/davget.xml"/>
+    <format name="luceneIndex" uri="cocoon://modules/forrest/lucene-index"/>
+    <!-- "xslt-clean" format is used by webDAV (and other editors?) to "clean" xml content before it is validated/saved --> 
+    <format name="xslt-clean" uri="fallback://lenya/modules/forrest/xslt/clean-xhtml.xsl"/>
+    <format name="icon" uri="cocoon://modules/forrest/icon"/>
+    
+  </component-instance>
+  
+</xconf>

Added: lenya/sandbox/modules/forrest/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/config/module.xml?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/config/module.xml (added)
+++ lenya/sandbox/modules/forrest/config/module.xml Tue Oct 30 13:50:08 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
+
+<module xmlns="http://apache.org/lenya/module/1.0">
+  <id>org.apache.lenya.modules.forrest</id>
+  <package>org.apache.lenya.modules</package>
+  <version>0.1-dev</version>
+  <name>Forrest</name>
+  <lenya-version>@lenya.version@</lenya-version>
+  <description>Forrest resource types</description>
+</module>

Added: lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java (added)
+++ lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java Tue Oct 30 13:50:08 2007
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.lenya.modules.forrest;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.linking.Link;
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentManager;
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.xml.DocumentHelper;
+import org.apache.lenya.xml.NamespaceHelper;
+import org.apache.xpath.XPathAPI;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+import com.ibm.icu.text.SimpleDateFormat;
+
+public class Importer extends AbstractLogEnabled {
+
+    private ServiceManager manager;
+
+    public Importer(ServiceManager manager, Logger logger) {
+        ContainerUtil.enableLogging(this, logger);
+        this.manager = manager;
+    }
+
+    protected static final String CONTENT_PATH = "src/documentation/content/xdocs";
+    protected static final String SITE_FILE = "site.xml";
+    protected static final String SITE_NAMESPACE = "http://apache.org/forrest/linkmap/1.0";
+    protected static final String ATTR_HREF = "href";
+    protected static final String ATTR_LABEL = "label";
+    protected static final Object RESOURCE_TYPE_NAME_FORREST = "forrestDocument20";
+    protected static final Object RESOURCE_TYPE_NAME_MEDIA = "resource";
+    protected static final String LANGUAGE = "en";
+    protected static final String EXTENSION = "xml";
+    protected static final String SITE_PROTOCOL = "site:";
+
+    public void importSite(Area area) throws Exception {
+
+        String docuSourceUri = "file:///Users/nobby/apache/lenya/docu";
+        String baseUri = docuSourceUri + "/" + CONTENT_PATH;
+
+        String siteFileUri = baseUri + "/" + SITE_FILE;
+        org.w3c.dom.Document siteXml = SourceUtil.readDOM(siteFileUri, this.manager);
+        NamespaceHelper helper = new NamespaceHelper(SITE_NAMESPACE, "", siteXml);
+
+        // map element names to UUIDs
+        Map links = new HashMap();
+
+        ServiceSelector selector = null;
+        ResourceType forrestResourceType = null;
+        ResourceType mediaResourceType = null;
+        DocumentManager docMgr = null;
+        try {
+            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
+            forrestResourceType = (ResourceType) selector.select(RESOURCE_TYPE_NAME_FORREST);
+            mediaResourceType = (ResourceType) selector.select(RESOURCE_TYPE_NAME_MEDIA);
+            docMgr = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
+
+            ImportInfo info = new ImportInfo();
+            info.area = area;
+            info.forrestResourceType = forrestResourceType;
+            info.mediaResourceType = mediaResourceType;
+            info.helper = helper;
+            info.docMgr = docMgr;
+            info.links = links;
+
+            NodeList nodes = XPathAPI.selectNodeList(siteXml.getDocumentElement(), "//*");
+            info.number = nodes.getLength();
+            info.start();
+
+            importChildren(info, siteXml.getDocumentElement(), baseUri, "");
+            convertLinks(info);
+        } finally {
+            if (docMgr != null) {
+                this.manager.release(docMgr);
+            }
+            if (selector != null) {
+                if (forrestResourceType != null) {
+                    selector.release(forrestResourceType);
+                }
+                if (mediaResourceType != null) {
+                    selector.release(mediaResourceType);
+                }
+                this.manager.release(selector);
+            }
+        }
+    }
+
+    protected void importChildren(ImportInfo info, Element element, String baseUri, String basePath)
+            throws Exception {
+        Element[] children = info.helper.getChildren(element);
+        for (int i = 0; i < children.length; i++) {
+            importDocument(info, baseUri, basePath, children[i]);
+        }
+    }
+
+    protected void importDocument(ImportInfo info, String baseUri, String basePath, Element element)
+            throws Exception {
+        String linkName = element.getLocalName();
+        String nodeName = convertToNodeName(linkName);
+
+        if (!info.area.getPublication().getDocumentBuilder().isValidDocumentName(nodeName)) {
+            throw new RuntimeException("[" + element.getLocalName()
+                    + "] can't be converted to a valid node name.");
+        }
+
+        String href = element.getAttribute(ATTR_HREF);
+        String title = element.getAttribute(ATTR_LABEL);
+
+        String sourceUri = concatPath(baseUri, href);
+
+        if (sourceUri.endsWith(".png") || sourceUri.endsWith(".gif")) {
+            createDocument(info, info.mediaResourceType, sourceUri, basePath, nodeName, linkName,
+                    title);
+        } else {
+            if (sourceUri.endsWith(".html")) {
+                sourceUri = sourceUri.substring(0, sourceUri.length() - ".href".length()) + ".xml";
+            }
+            org.w3c.dom.Document xml = null;
+            try {
+                xml = SourceUtil.readDOM(sourceUri, this.manager);
+            } catch (Exception ignore) {
+            }
+
+            if (xml == null) {
+                createDocument(info, info.forrestResourceType,
+                        getSampleUri(info.forrestResourceType), basePath, nodeName, linkName, title);
+            } else {
+                createDocument(info, info.forrestResourceType, sourceUri, basePath, nodeName,
+                        linkName, title);
+            }
+        }
+
+        if (href.equals("") || href.endsWith("/")) {
+            importChildren(info, element, sourceUri, concatPath(basePath, nodeName));
+        }
+
+    }
+
+    protected String concatPath(String path1, String path2) {
+        StringBuffer path = new StringBuffer();
+        path.append(path1);
+
+        if (!path1.endsWith("/")) {
+            path.append("/");
+        }
+        if (path2.startsWith("/")) {
+            path.append(path2.substring(1));
+        } else {
+            path.append(path2);
+        }
+        return path.toString();
+    }
+
+    protected String getSampleUri(ResourceType type) {
+        ResourceType.Sample sample = type.getSample(type.getSampleNames()[0]);
+        String sourceUri = sample.getUri();
+        return sourceUri;
+    }
+
+    protected void createDocument(ImportInfo info, ResourceType type, String sourceUri,
+            String basePath, String nodeName, String linkName, String title) throws Exception {
+        String path = concatPath(basePath, nodeName);
+        DocumentFactory factory = info.area.getPublication().getFactory();
+        try {
+            int lastDotIndex = sourceUri.lastIndexOf(".");
+            String extension = sourceUri.substring(lastDotIndex + 1);
+            Document doc = info.docMgr.add(factory, type, sourceUri, info.area.getPublication(),
+                    info.area.getName(), path, LANGUAGE, extension, title, true);
+            info.links.put(linkName, doc.getUUID());
+            log("Created " + extension.toUpperCase() + " document (" + info.counterToString() + ") [" + path + "]");
+        } catch (Exception e) {
+            log("A problem occured:");
+            log("Path: '" + path + "'");
+            log("URI:  '" + sourceUri + "'");
+            throw e;
+        }
+    }
+
+    protected String convertToNodeName(String string) {
+        return string.replaceAll("[^a-zA-Z0-9\\-]+", "");
+    }
+
+    protected void log(String message) {
+        System.out.println(message);
+        getLogger().info(message);
+    }
+
+    protected class ImportInfo {
+        protected int number = 0;
+        protected int counter = 0;
+        protected ResourceType mediaResourceType;
+        protected ResourceType forrestResourceType;
+        protected DocumentManager docMgr;
+        protected NamespaceHelper helper;
+        protected Area area;
+        protected Map links;
+        protected long startTime;
+        protected Calendar startCal;
+        
+        protected static final String dateFormat = "HH:mm:ss";
+
+        protected int next() {
+            return ++this.counter;
+        }
+
+        protected void start() {
+            this.counter = 0;
+            this.startTime = new Date().getTime();
+            this.startCal = new GregorianCalendar();
+        }
+        
+        protected String counterToString() {
+            int c = next();
+            String count = Integer.toString(c);
+            String nr = Integer.toString(this.number);
+            StringBuffer buf = new StringBuffer();
+            while (buf.length() < nr.length() - count.length()) {
+                buf.append(" ");
+            }
+            buf.append(count);
+            buf.append(" of ");
+            buf.append(nr);
+            buf.append(", estimated time: ");
+            int elapsed = (int) (new Date().getTime() - this.startTime);
+            long expected = Math.round(elapsed * (double) this.number / (double) c);
+            long remaining = expected - Math.round(elapsed);
+            Date date = new Date(remaining);
+            date.setHours(date.getHours() - 1);
+            buf.append(new SimpleDateFormat(dateFormat).format(date));
+            
+            return buf.toString();
+        }
+    }
+
+    protected void convertLinks(ImportInfo info) throws Exception {
+        Document[] docs = info.area.getDocuments();
+        info.start();
+        info.number = docs.length;
+        for (int i = 0; i < docs.length; i++) {
+            if (docs[i].getResourceType().getName().equals(info.forrestResourceType.getName())) {
+                log("Converting links (" + info.counterToString() + "): " + docs[i].getPath());
+                org.w3c.dom.Document xml = DocumentHelper.readDocument(docs[i].getInputStream());
+                convertLinks(info, xml.getDocumentElement());
+                DocumentHelper.writeDocument(xml, docs[i].getOutputStream());
+            }
+        }
+    }
+
+    protected void convertLinks(ImportInfo info, Element element) {
+        NamedNodeMap attrs = element.getAttributes();
+        for (int i = 0; i < attrs.getLength(); i++) {
+            Attr attr = (Attr) attrs.item(i);
+            String value = attr.getNodeValue();
+            if (value.startsWith(SITE_PROTOCOL)) {
+                log("Converting link [" + value + "]");
+                String name = value.substring(SITE_PROTOCOL.length());
+                if (info.links.containsKey(name)) {
+                    String uuid = (String) info.links.get(name);
+                    Link link = new Link();
+                    link.setUuid(uuid);
+                    attr.setNodeValue(link.getUri());
+                } else {
+                    log("No document found for link [" + value + "]");
+                }
+            }
+        }
+        Element[] children = DocumentHelper.getChildren(element);
+        for (int i = 0; i < children.length; i++) {
+            convertLinks(info, children[i]);
+        }
+    }
+
+}

Added: lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java (added)
+++ lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java Tue Oct 30 13:50:08 2007
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.
+ *
+ */
+package org.apache.lenya.modules.forrest;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.linking.Link;
+import org.apache.lenya.cms.linking.LinkManager;
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.site.SiteStructure;
+
+/**
+ * Import example content into test publication.
+ */
+public class ImportTest extends AbstractAccessControlTest {
+
+    /**
+     * @throws Exception if an error occurs.
+     */
+    public void testImport() throws Exception {
+        
+        Session session = login("lenya");
+        
+        Publication pub = getPublication(session, "docu");
+        Area area = pub.getArea("authoring");
+        
+        if (area.getDocuments().length == 0) {
+            Importer importer = new Importer(getManager(), getLogger());
+            importer.importSite(area);
+            session.commit();
+        }
+        
+        assertTrue(area.getSite().contains("/project-information"));
+    }
+
+}

Added: lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/navigation/menu.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/navigation/menu.xsl?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/navigation/menu.xsl (added)
+++ lenya/sandbox/modules/forrest/lenya/modules/sitetree/xslt/navigation/menu.xsl Tue Oct 30 13:50:08 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: menu.xsl 42703 2004-03-13 12:57:53Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
+    xmlns="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="nav"
+    >
+  
+  
+  <xsl:import href="template-fallback://lenya/modules/sitetree/xslt/navigation/menu.xsl"/>
+
+
+  <xsl:template match="nav:site/nav:node">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/modules/forrest/resources/samples/forrestDocument20.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/resources/samples/forrestDocument20.xml?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/resources/samples/forrestDocument20.xml (added)
+++ lenya/sandbox/modules/forrest/resources/samples/forrestDocument20.xml Tue Oct 30 13:50:08 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-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.
+-->
+
+<!-- $Id: index.xml 55543 2004-10-26 00:14:59Z gregor $ -->
+
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+  <header>
+    <title>Apache Lenya Documentation</title>
+  </header>
+  <body>
+    <p>
+      This is a Forrest Document 2.0 sample.
+    </p>
+  </body>
+</document>

Added: lenya/sandbox/modules/forrest/resources/schemas/document-v20.mod.rng
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/resources/schemas/document-v20.mod.rng?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/resources/schemas/document-v20.mod.rng (added)
+++ lenya/sandbox/modules/forrest/resources/schemas/document-v20.mod.rng Tue Oct 30 13:50:08 2007
@@ -0,0 +1,1014 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!--
+  ===================================================================
+  
+       Apache Common Documentation elements (Version 2.0)
+  
+  PURPOSE:
+    This DTD was developed to create a simple yet powerful document
+    type for software documentation for use with the Apache projects.
+  
+  TYPICAL INVOCATION:
+  
+    <!ENTITY % document PUBLIC
+        "-//APACHE//ENTITIES Documentation Vxy//EN"
+        "document-vxy.mod">
+    %document;
+  
+    where
+  
+      x := major version
+      y := minor version
+  
+  NOTES:
+  
+  FIXME:
+  
+  CHANGE HISTORY:
+  [Version 2.0a]
+    20030505  Add a meta element to the header, for generic metadata
+    20030505  Zap jump and fork, and rename 'link' to 'a' for better HTMLness
+    20030510  Fix bug which allowed nested lists like <ol><ol>. Now lists can only contain li's.
+  
+  ====================================================================
+-->
+<!-- =============================================================== -->
+<!-- Useful entities for increased DTD readability -->
+<!-- =============================================================== -->
+<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+  <define name="text">
+    <text/>
+  </define>
+  <!-- Entities referred to later on are defined up front -->
+  <define name="markup">
+    <choice>
+      <ref name="strong"/>
+      <ref name="em"/>
+      <ref name="code"/>
+      <ref name="sub"/>
+      <ref name="sup"/>
+    </choice>
+  </define>
+  <define name="special-inline">
+    <choice>
+      <ref name="br"/>
+      <ref name="img"/>
+      <ref name="icon"/>
+      <ref name="acronym"/>
+      <ref name="map"/>
+    </choice>
+  </define>
+  <define name="links">
+    <ref name="a"/>
+  </define>
+  <define name="paragraphs">
+    <choice>
+      <ref name="p"/>
+      <ref name="source"/>
+      <ref name="note"/>
+      <ref name="warning"/>
+      <ref name="fixme"/>
+    </choice>
+  </define>
+  <define name="tables">
+    <ref name="table"/>
+  </define>
+  <define name="lists">
+    <choice>
+      <ref name="ol"/>
+      <ref name="ul"/>
+      <ref name="dl"/>
+    </choice>
+  </define>
+  <define name="special-blocks">
+    <choice>
+      <ref name="figure"/>
+      <ref name="anchor"/>
+    </choice>
+  </define>
+  <!-- these are used for image maps -->
+  <define name="Shape">
+    <choice>
+      <value>rect</value>
+      <value>circle</value>
+      <value>poly</value>
+      <value>default</value>
+    </choice>
+  </define>
+  <define name="Coords">
+    <data type="string" datatypeLibrary=""/>
+  </define>
+  <!-- =============================================================== -->
+  <!-- Entities for general XML compliance -->
+  <!-- =============================================================== -->
+  <!--
+    Common attributes
+    Every element has an ID attribute (sometimes required,
+    but usually optional) for links. %common.att;
+    is for common attributes where the ID is optional, and
+    %common-idreq.att; is for common attributes where the
+    ID is required.
+  -->
+  <define name="common.att">
+    <optional>
+      <attribute name="id">
+        <data type="ID"/>
+      </attribute>
+    </optional>
+    <optional>
+      <attribute name="class">
+        <data type="NMTOKEN"/>
+      </attribute>
+    </optional>
+    <optional>
+      <attribute name="xml:lang">
+        <data type="NMTOKEN"/>
+      </attribute>
+    </optional>
+  </define>
+  <define name="common-idreq.att">
+    <attribute name="id">
+      <data type="ID"/>
+    </attribute>
+    <optional>
+      <attribute name="class">
+        <data type="NMTOKEN"/>
+      </attribute>
+    </optional>
+    <optional>
+      <attribute name="xml:lang">
+        <data type="NMTOKEN"/>
+      </attribute>
+    </optional>
+  </define>
+  <!--
+    xml:space attribute ===============================================
+            Indicates that the element contains white space
+            that the formatter or other application should retain,
+            as appropriate to its function.
+    ====================================================================
+  -->
+  <define name="xmlspace.att">
+    <optional>
+      <attribute name="xml:space" a:defaultValue="preserve">
+        <value>preserve</value>
+      </attribute>
+    </optional>
+  </define>
+  <!--
+    def attribute =====================================================
+            Points to the element where the relevant definition can be
+            found, using the IDREF mechanism.  %def.att; is for optional
+            def attributes, and %def-req.att; is for required def
+            attributes.
+    ====================================================================
+  -->
+  <!--
+    ref attribute =====================================================
+            Points to the element where more information can be found,
+            using the IDREF mechanism.  %ref.att; is for optional
+            ref attributes, and %ref-req.att; is for required ref
+            attributes.
+    ==================================================================
+  -->
+  <!-- =============================================================== -->
+  <!-- Entities for general usage -->
+  <!-- =============================================================== -->
+  <!--
+    Key attribute =====================================================
+            Optionally provides a sorting or indexing key, for cases when
+            the element content is inappropriate for this purpose.
+    ====================================================================
+  -->
+  <!--
+    Title attributes ==================================================
+            Indicates that the element requires to have a title attribute.
+    ====================================================================
+  -->
+  <!--
+    Name attributes ==================================================
+            Indicates that the element requires to have a name attribute.
+    ====================================================================
+  -->
+  <define name="name.att">
+    <attribute name="name"/>
+  </define>
+  <!--
+    Email attributes ==================================================
+            Indicates that the element requires to have an email attribute.
+    ====================================================================
+  -->
+  <define name="email.att">
+    <attribute name="email"/>
+  </define>
+  <!--
+    Link attributes ===================================================
+            Indicates that the element requires to have hyperlink attributes.
+    ====================================================================
+  -->
+  <define name="link.att">
+    <attribute name="href"/>
+    <optional>
+      <attribute name="title"/>
+    </optional>
+  </define>
+  <!-- =============================================================== -->
+  <!-- General definitions -->
+  <!-- =============================================================== -->
+  <!-- A person is a general unparsed human entity -->
+  <define name="person">
+    <element name="person">
+      <ref name="person.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="person.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <ref name="name.att"/>
+    <ref name="email.att"/>
+  </define>
+  <!-- =============================================================== -->
+  <!-- Content definitions -->
+  <!-- =============================================================== -->
+  <define name="local.inline">
+    <notAllowed/>
+  </define>
+  <define name="link-content.mix">
+    <choice>
+      <ref name="text"/>
+      <ref name="markup"/>
+      <ref name="special-inline"/>
+      <ref name="local.inline"/>
+    </choice>
+  </define>
+  <define name="content.mix">
+    <choice>
+      <ref name="link-content.mix"/>
+      <ref name="links"/>
+    </choice>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Phrase Markup -->
+  <!-- ==================================================== -->
+  <!-- Strong (typically bold) -->
+  <define name="strong">
+    <element name="strong">
+      <ref name="strong.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="strong.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Emphasis (typically italic) -->
+  <define name="em">
+    <element name="em">
+      <ref name="em.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="em.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Code (typically monospaced) -->
+  <define name="code">
+    <element name="code">
+      <ref name="code.attlist"/>
+      <ref name="text"/>
+    </element>
+  </define>
+  <define name="code.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Superscript (typically smaller and higher) -->
+  <define name="sup">
+    <element name="sup">
+      <ref name="sup.attlist"/>
+      <ref name="text"/>
+    </element>
+  </define>
+  <define name="sup.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Subscript (typically smaller and lower) -->
+  <define name="sub">
+    <element name="sub">
+      <ref name="sub.attlist"/>
+      <ref name="text"/>
+    </element>
+  </define>
+  <define name="sub.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Hypertextual Links -->
+  <!-- ==================================================== -->
+  <!-- hyperlink (equivalent of <a ...>) -->
+  <!-- http://www.w3.org/TR/xhtml2/mod-hypertext.html#s_hypertextmodule -->
+  <define name="a">
+    <element name="a">
+      <ref name="a.attlist"/>
+      <zeroOrMore>
+        <ref name="link-content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="a.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <ref name="link.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Specials -->
+  <!-- ==================================================== -->
+  <!-- Breakline Object (typically forces line break) -->
+  <define name="br">
+    <element name="br">
+      <ref name="br.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="br.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Image Object (typically an inlined image) -->
+  <define name="img">
+    <element name="img">
+      <ref name="img.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="img.attlist" combine="interleave">
+    <attribute name="src"/>
+    <attribute name="alt"/>
+    <optional>
+      <attribute name="height"/>
+    </optional>
+    <optional>
+      <attribute name="width"/>
+    </optional>
+    <optional>
+      <attribute name="usemap"/>
+    </optional>
+    <optional>
+      <attribute name="ismap">
+        <choice>
+          <value>ismap</value>
+        </choice>
+      </attribute>
+    </optional>
+    <ref name="common.att"/>
+  </define>
+  <!-- support the img usemap attribute -->
+  <define name="map">
+    <element name="map">
+      <ref name="map.attlist"/>
+      <oneOrMore>
+        <ref name="area"/>
+      </oneOrMore>
+    </element>
+  </define>
+  <define name="map.attlist" combine="interleave">
+    <optional>
+      <attribute name="name"/>
+    </optional>
+  </define>
+  <define name="area">
+    <element name="area">
+      <ref name="area.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="area.attlist" combine="interleave">
+    <optional>
+      <attribute name="shape" a:defaultValue="rect">
+        <ref name="Shape"/>
+      </attribute>
+    </optional>
+    <optional>
+      <attribute name="coords">
+        <ref name="Coords"/>
+      </attribute>
+    </optional>
+    <ref name="link.att"/>
+    <optional>
+      <attribute name="nohref">
+        <choice>
+          <value>nohref</value>
+        </choice>
+      </attribute>
+    </optional>
+    <attribute name="alt"/>
+  </define>
+  <!-- Image Icon (typically an inlined image placed as graphical item) -->
+  <define name="icon">
+    <element name="icon">
+      <ref name="icon.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="icon.attlist" combine="interleave">
+    <attribute name="src"/>
+    <attribute name="alt"/>
+    <optional>
+      <attribute name="height"/>
+    </optional>
+    <optional>
+      <attribute name="width"/>
+    </optional>
+    <ref name="common.att"/>
+  </define>
+  <!-- Acronym (in modern browsers, will have rollover text) -->
+  <define name="acronym">
+    <element name="acronym">
+      <ref name="acronym.attlist"/>
+      <zeroOrMore>
+        <ref name="text"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="acronym.attlist" combine="interleave">
+    <attribute name="title"/>
+    <ref name="common.att"/>
+  </define>
+  <!-- =============================================================== -->
+  <!-- Blocks definitions -->
+  <!-- =============================================================== -->
+  <define name="local.blocks">
+    <notAllowed/>
+  </define>
+  <define name="blocks">
+    <choice>
+      <ref name="paragraphs"/>
+      <ref name="tables"/>
+      <ref name="lists"/>
+      <ref name="special-blocks"/>
+      <ref name="local.blocks"/>
+    </choice>
+  </define>
+  <!-- Flow mixes block and inline -->
+  <define name="flow">
+    <choice>
+      <ref name="content.mix"/>
+      <ref name="blocks"/>
+    </choice>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Paragraphs -->
+  <!-- ==================================================== -->
+  <!-- Text Paragraph (normally vertically space delimited. Space can be preserved.) -->
+  <define name="p">
+    <element name="p">
+      <ref name="p.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="p.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <optional>
+      <attribute name="xml:space">
+        <choice>
+          <value>default</value>
+          <value>preserve</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
+  <!-- Source Paragraph (normally space is preserved) -->
+  <define name="source">
+    <element name="source">
+      <ref name="source.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="source.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <ref name="xmlspace.att"/>
+  </define>
+  <!-- Note Paragraph (normally shown encapsulated) -->
+  <define name="note">
+    <element name="note">
+      <ref name="note.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="note.attlist" combine="interleave">
+    <optional>
+      <attribute name="label"/>
+    </optional>
+    <ref name="common.att"/>
+  </define>
+  <!-- Warning Paragraph (normally shown with eye-catching colors) -->
+  <define name="warning">
+    <element name="warning">
+      <ref name="warning.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="warning.attlist" combine="interleave">
+    <optional>
+      <attribute name="label"/>
+    </optional>
+    <ref name="common.att"/>
+  </define>
+  <!-- Fixme Paragraph (normally not shown) -->
+  <define name="fixme">
+    <element name="fixme">
+      <ref name="fixme.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="fixme.attlist" combine="interleave">
+    <attribute name="author"/>
+    <ref name="common.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Tables -->
+  <!-- ==================================================== -->
+  <!-- Attributes that indicate the spanning of the table cell -->
+  <define name="cell.span">
+    <optional>
+      <attribute name="colspan" a:defaultValue="1"/>
+    </optional>
+    <optional>
+      <attribute name="rowspan" a:defaultValue="1"/>
+    </optional>
+  </define>
+  <!-- Table element -->
+  <define name="table">
+    <element name="table">
+      <ref name="table.attlist"/>
+      <optional>
+        <ref name="caption"/>
+      </optional>
+      <oneOrMore>
+        <ref name="tr"/>
+      </oneOrMore>
+    </element>
+  </define>
+  <define name="table.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- The table title -->
+  <define name="caption">
+    <element name="caption">
+      <ref name="caption.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="caption.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- The table row element -->
+  <define name="tr">
+    <element name="tr">
+      <ref name="tr.attlist"/>
+      <oneOrMore>
+        <choice>
+          <ref name="th"/>
+          <ref name="td"/>
+        </choice>
+      </oneOrMore>
+    </element>
+  </define>
+  <define name="tr.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- The table row header element -->
+  <define name="th">
+    <element name="th">
+      <ref name="th.attlist"/>
+      <zeroOrMore>
+        <ref name="flow"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="th.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <ref name="cell.span"/>
+  </define>
+  <!-- The table row description element -->
+  <define name="td">
+    <element name="td">
+      <ref name="td.attlist"/>
+      <zeroOrMore>
+        <ref name="flow"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="td.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <ref name="cell.span"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Lists -->
+  <!-- ==================================================== -->
+  <!-- List item -->
+  <define name="li">
+    <element name="li">
+      <ref name="li.attlist"/>
+      <zeroOrMore>
+        <ref name="flow"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="li.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Unordered list (typically bulleted) -->
+  <define name="ul">
+    <element name="ul">
+      <ref name="ul.attlist"/>
+      <oneOrMore>
+        <ref name="li"/>
+      </oneOrMore>
+    </element>
+  </define>
+  <!--
+    spacing attribute:
+    Use "normal" to get normal vertical spacing for items;
+    use "compact" to get less spacing.  The default is dependent
+    on the stylesheet.
+  -->
+  <define name="ul.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <optional>
+      <attribute name="spacing">
+        <choice>
+          <value>normal</value>
+          <value>compact</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
+  <!-- Ordered list (typically numbered) -->
+  <define name="ol">
+    <element name="ol">
+      <ref name="ol.attlist"/>
+      <oneOrMore>
+        <ref name="li"/>
+      </oneOrMore>
+    </element>
+  </define>
+  <!--
+    spacing attribute:
+    Use "normal" to get normal vertical spacing for items;
+    use "compact" to get less spacing.  The default is dependent
+    on the stylesheet.
+  -->
+  <define name="ol.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <optional>
+      <attribute name="spacing">
+        <choice>
+          <value>normal</value>
+          <value>compact</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
+  <!-- Definition list (typically two-column) -->
+  <define name="dl">
+    <element name="dl">
+      <ref name="dl.attlist"/>
+      <oneOrMore>
+        <ref name="dt"/>
+        <ref name="dd"/>
+      </oneOrMore>
+    </element>
+  </define>
+  <define name="dl.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Definition term -->
+  <define name="dt">
+    <element name="dt">
+      <ref name="dt.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="dt.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- Definition description -->
+  <define name="dd">
+    <element name="dd">
+      <ref name="dd.attlist"/>
+      <zeroOrMore>
+        <ref name="flow"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="dd.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Special Blocks -->
+  <!-- ==================================================== -->
+  <!-- Image Block (typically a separated and centered image) -->
+  <define name="figure">
+    <element name="figure">
+      <ref name="figure.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="figure.attlist" combine="interleave">
+    <attribute name="src"/>
+    <attribute name="alt"/>
+    <optional>
+      <attribute name="height"/>
+    </optional>
+    <optional>
+      <attribute name="width"/>
+    </optional>
+    <optional>
+      <attribute name="usemap"/>
+    </optional>
+    <optional>
+      <attribute name="ismap">
+        <choice>
+          <value>ismap</value>
+        </choice>
+      </attribute>
+    </optional>
+    <optional>
+      <attribute name="align"/>
+    </optional>
+    <ref name="common.att"/>
+  </define>
+  <!-- anchor point (equivalent of <a name="...">, typically not rendered) -->
+  <define name="anchor">
+    <element name="anchor">
+      <ref name="anchor.attlist"/>
+      <empty/>
+    </element>
+  </define>
+  <define name="anchor.attlist" combine="interleave">
+    <ref name="common-idreq.att"/>
+  </define>
+  <!-- =============================================================== -->
+  <!-- Document -->
+  <!-- =============================================================== -->
+  <define name="document">
+    <element name="document">
+      <ref name="document.attlist"/>
+      <ref name="header"/>
+      <ref name="body"/>
+      <optional>
+        <ref name="footer"/>
+      </optional>
+    </element>
+  </define>
+  <define name="document.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Header -->
+  <!-- ==================================================== -->
+  <define name="local.headers">
+    <empty/>
+  </define>
+  <define name="header">
+    <element name="header">
+      <ref name="header.attlist"/>
+      <ref name="title"/>
+      <optional>
+        <ref name="subtitle"/>
+      </optional>
+      <optional>
+        <ref name="version"/>
+      </optional>
+      <optional>
+        <ref name="type"/>
+      </optional>
+      <optional>
+        <ref name="authors"/>
+      </optional>
+      <zeroOrMore>
+        <ref name="notice"/>
+      </zeroOrMore>
+      <optional>
+        <ref name="abstract"/>
+      </optional>
+      <zeroOrMore>
+        <ref name="meta"/>
+      </zeroOrMore>
+      <ref name="local.headers"/>
+    </element>
+  </define>
+  <define name="header.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="title">
+    <element name="title">
+      <ref name="title.attlist"/>
+      <zeroOrMore>
+        <choice>
+          <ref name="text"/>
+          <ref name="markup"/>
+          <ref name="links"/>
+          <ref name="special-inline"/>
+        </choice>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="title.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="subtitle">
+    <element name="subtitle">
+      <ref name="subtitle.attlist"/>
+      <zeroOrMore>
+        <choice>
+          <ref name="text"/>
+          <ref name="markup"/>
+        </choice>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="subtitle.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="version">
+    <element name="version">
+      <ref name="version.attlist"/>
+      <ref name="text"/>
+    </element>
+  </define>
+  <define name="version.attlist" combine="interleave">
+    <ref name="common.att"/>
+    <optional>
+      <attribute name="major"/>
+    </optional>
+    <optional>
+      <attribute name="minor"/>
+    </optional>
+    <optional>
+      <attribute name="fix"/>
+    </optional>
+    <optional>
+      <attribute name="tag"/>
+    </optional>
+  </define>
+  <define name="type">
+    <element name="type">
+      <ref name="type.attlist"/>
+      <ref name="text"/>
+    </element>
+  </define>
+  <define name="type.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="authors">
+    <element name="authors">
+      <ref name="authors.attlist"/>
+      <oneOrMore>
+        <ref name="person"/>
+      </oneOrMore>
+    </element>
+  </define>
+  <define name="authors.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="notice">
+    <element name="notice">
+      <ref name="notice.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="notice.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="abstract">
+    <element name="abstract">
+      <ref name="abstract.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="abstract.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- See http://www.w3.org/TR/xhtml2/mod-meta.html#s_metamodule -->
+  <define name="meta">
+    <element name="meta">
+      <ref name="meta.attlist"/>
+      <text/>
+    </element>
+  </define>
+  <define name="meta.attlist" combine="interleave">
+    <attribute name="name">
+      <data type="NMTOKEN"/>
+    </attribute>
+    <ref name="common.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Body -->
+  <!-- ==================================================== -->
+  <define name="local.sections">
+    <notAllowed/>
+  </define>
+  <define name="sections">
+    <choice>
+      <ref name="section"/>
+      <ref name="local.sections"/>
+    </choice>
+  </define>
+  <define name="body">
+    <element name="body">
+      <ref name="body.attlist"/>
+      <oneOrMore>
+        <choice>
+          <ref name="sections"/>
+          <ref name="blocks"/>
+        </choice>
+      </oneOrMore>
+    </element>
+  </define>
+  <define name="body.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <define name="section">
+    <element name="section">
+      <ref name="section.attlist"/>
+      <ref name="title"/>
+      <zeroOrMore>
+        <choice>
+          <ref name="sections"/>
+          <ref name="blocks"/>
+        </choice>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="section.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+  <!-- ==================================================== -->
+  <!-- Footer -->
+  <!-- ==================================================== -->
+  <define name="local.footers">
+    <notAllowed/>
+  </define>
+  <define name="footer">
+    <element name="footer">
+      <ref name="footer.attlist"/>
+      <choice>
+        <ref name="legal"/>
+        <ref name="local.footers"/>
+      </choice>
+    </element>
+  </define>
+  <define name="footer.attlist" combine="interleave">
+    <empty/>
+  </define>
+  <define name="legal">
+    <element name="legal">
+      <ref name="legal.attlist"/>
+      <zeroOrMore>
+        <ref name="content.mix"/>
+      </zeroOrMore>
+    </element>
+  </define>
+  <define name="legal.attlist" combine="interleave">
+    <ref name="common.att"/>
+  </define>
+</grammar>
+<!-- =============================================================== -->
+<!-- End of DTD -->
+<!-- =============================================================== -->

Added: lenya/sandbox/modules/forrest/resources/schemas/document-v20.rng
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/resources/schemas/document-v20.rng?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/resources/schemas/document-v20.rng (added)
+++ lenya/sandbox/modules/forrest/resources/schemas/document-v20.rng Tue Oct 30 13:50:08 2007
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!--
+  ===================================================================
+  
+       Apache Documentation DTD (Version 2.0)
+  
+  PURPOSE:
+    This DTD was developed to create a simple yet powerful document
+    type for software documentation for use with the Apache projects.
+    It is an XML-compliant DTD and it's maintained by the Apache XML
+    project.
+  
+    The v2.x series of this DTD is an evolution of the 1.x series, incorporating
+    lessons learned. Various new much-needed elements have been added, some unused
+    features removed, and some renamed (link -> a). 2.x is not
+    backwards-compatible, although a stylesheet can probably do the conversion.
+  
+  TYPICAL INVOCATION:
+  
+    <!DOCTYPE document PUBLIC
+         "-//APACHE//DTD Documentation V2.1a//EN"
+         "document-vxy.dtd">
+  
+    where
+  
+      x := major version
+      y := minor version
+  
+  NOTES:
+    Many of the design patterns used in this DTD were take from the
+    W3C XML Specification DTD edited by Eve Maler <el...@arbortext.com>.
+  
+    Where possible, great care has been used to reuse HTML tag
+    names to reduce learning efforts and to allow HTML editors to be
+    used for complex authorings like tables and lists.
+  
+  EXTENSIBILITY:
+    This DTD includes several empty placeholders that can be used to
+    extend it. These placeholders are implemented with empty entities. Here
+    is the list of those empty entities and what they are used for:
+  
+      - local.inline: this entity should contain extended definitions of
+                      elements that can be used 'inline', or directly inside
+                      the content. An example for this entity could be
+  
+                          <!ENTITY % local.inline "|citation">
+  
+      - local.blocks: this entity should contain extended definitions of
+                      elements that behave as 'blocks', thus can be visually
+                      rendered as areas on the canvas. An example for this
+                      entity could be:
+  
+                          <!ENTITY % local.blocks "|poem">
+  
+      - local.sections: this entity should contain extended definitions of
+                        elements that behave as 'sections', thus can be considered
+                        containers of block-level elements. An example for
+                        this entity could be:
+  
+                          <!ENTITY % local.sections "|chapter">
+  
+      - local.headers: this entity should contain extended definitions of
+                       elements that behave as parts of the document header.
+                       An example for this header could be:
+  
+                          <!ENTITY % local.headers ", notes?">
+  
+      - local.footers: this entity should contain extended definitions of
+                       elements that behave as parts of the document footer.
+                       An example for this header could be:
+  
+                          <!ENTITY % local.footers ", annotations*">
+  
+  ====================================================================
+-->
+<!-- =============================================================== -->
+<!-- Include the Common ISO Character Entity Sets -->
+<!-- =============================================================== -->
+<!-- =============================================================== -->
+<!-- Document -->
+<!-- =============================================================== -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+  <include href="document-v20.mod.rng"/>
+  <start>
+    <choice>
+      <ref name="document"/>
+    </choice>
+  </start>
+</grammar>
+<!-- =============================================================== -->
+<!-- End of DTD -->
+<!-- =============================================================== -->

Added: lenya/sandbox/modules/forrest/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/sitemap.xmap?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/sitemap.xmap (added)
+++ lenya/sandbox/modules/forrest/sitemap.xmap Tue Oct 30 13:50:08 2007
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: doctypes.xmap 179488 2005-06-02 02:29:39Z gregor $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components ================================ -->
+
+  <map:components>
+  
+    <map:serializers default="xhtml"> 
+      <map:serializer name="xml-get" src="org.apache.cocoon.serialization.XMLSerializer" mime-type="text/xml">
+        <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
+        <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
+        <encoding>UTF-8</encoding>
+      </map:serializer>
+    </map:serializers>
+ 
+  </map:components>
+
+  <map:pipelines>
+
+    <!-- search pipeline -->
+    <map:pipeline>
+      
+      <!-- {pub-id}/{area}/{uuid}/{language} -->
+      <map:match pattern="metadata/*/*/*/*">
+        <map:generate type="lenyaMetaData" src="lenya-document:{3},pub={1},area={2},lang={4}"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!-- {pub-id}/{area}/{uuid}/{language} -->
+      <map:match pattern="lucene-index/*/*/*/*">
+        <map:aggregate element="cmsbody">
+          <map:part src="lenya-document:{3},pub={1},area={2},lang={4}"/>
+          <map:part src="cocoon:/metadata/{1}/{2}/{3}/{4}"/>
+        </map:aggregate>
+  
+        <map:transform src="fallback://lenya/modules/forrest/xslt/forrest2index.xsl">
+          <map:parameter name="url" value="{request:requestURI}"/>
+        </map:transform>
+        
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+    
+    <map:pipeline>
+
+      <!-- webdav GET matcher -->
+      <map:match pattern="davget.xml">
+        <map:act type="set-header">
+          <map:parameter name="Last-Modified" value="{date-iso8601-rfc822:{page-envelope:document-lastmodified}}" />
+          <map:generate src="lenya-document:{page-envelope:document-uuid},lang={page-envelope:document-language}"/>
+          <map:transform type="uuid2url"/>
+          <map:transform type="proxy">
+            <map:parameter name="urls" value="absolute"/>
+          </map:transform>
+          <map:serialize type="xml-get"/>
+        </map:act>
+      </map:match>
+
+      <!-- parametrized doctype matcher -->
+      <!-- pattern="{format}.xml" -->
+      <map:match pattern="*.xml">
+        <map:generate src="cocoon:/{1}.xml/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-uuid}/{page-envelope:document-language}"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <!-- {format}.xml/{pubId}/{area}/{uuid}/{language} -->
+      <map:match pattern="*.xml/*/*/*/*">
+        <map:generate src="lenya-document:{4},lang={5}{link:rev}"/>
+        <map:transform src="fallback://lenya/modules/forrest/xslt/forrest2xhtml.xsl">
+          <map:parameter name="rendertype" value="{request-param:rendertype}"/>
+          <map:parameter name="nodeid" value="{doc-info:{2}:{3}:{4}:{5}:nodeName}"/>
+          <map:parameter name="language" value="{4}"/>
+        </map:transform>
+        <map:transform type="cinclude"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <map:match pattern="icon/*/*/*/*">
+        <map:read src="fallback://lenya/modules/xhtml/resources/icons/xhtml.gif"/>
+      </map:match>
+      
+    </map:pipeline>
+    
+  </map:pipelines>
+</map:sitemap>

Added: lenya/sandbox/modules/forrest/xslt/forrest2index.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/xslt/forrest2index.xsl?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/xslt/forrest2index.xsl (added)
+++ lenya/sandbox/modules/forrest/xslt/forrest2index.xsl Tue Oct 30 13:50:08 2007
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:lucene="http://apache.org/cocoon/lucene/1.0"
+  xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+
+<xsl:param name="uri"/>
+
+<xsl:variable name="boost" select="number(/descendant-or-self::dc:rights)"/>  
+
+<xsl:template match="/">
+  <!-- attributes of the index and document element will be added by the lucene module -->
+  <lucene:index>
+    <lucene:document>
+      <lucene:field name="url" boost="{$boost}"><xsl:value-of select="$uri"/></lucene:field>
+      <xsl:apply-templates/>
+    </lucene:document>
+  </lucene:index>  
+</xsl:template>
+
+<xsl:template match="dc:rights" priority="1"/>
+
+<xsl:template match="xhtml:body" priority="1">
+  <lucene:field name="body" boost="{$boost}">
+    <xsl:for-each select=".//text()">
+      <xsl:value-of select="concat(normalize-space(.),' ')"/>
+    </xsl:for-each>
+  </lucene:field>
+</xsl:template>
+
+<xsl:template match="dc:title" priority="1">
+  <lucene:field name="title" boost="{$boost}"><xsl:value-of select="."/></lucene:field>
+</xsl:template>
+
+<xsl:template match="dc:description" priority="1">
+  <lucene:field name="description" boost="{$boost}"><xsl:value-of select="."/></lucene:field>
+</xsl:template>
+
+<xsl:template match="dc:subject" priority="1">
+  <lucene:field name="subject" boost="{$boost}"><xsl:value-of select="."/></lucene:field>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-1">
+  <xsl:apply-templates/>
+</xsl:template>
+
+</xsl:stylesheet>

Added: lenya/sandbox/modules/forrest/xslt/forrest2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/xslt/forrest2xhtml.xsl?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/xslt/forrest2xhtml.xsl (added)
+++ lenya/sandbox/modules/forrest/xslt/forrest2xhtml.xsl Tue Oct 30 13:50:08 2007
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!--+
+  | Convert samples file to the HTML page. Uses styles/main.css stylesheet.
+  +-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xlink="http://www.w3.org/1999/xlink"
+  xmlns="http://www.w3.org/1999/xhtml">
+  
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title>Apache Forrest</title><link rel="SHORTCUT ICON" href="favicon.ico"/>
+        <xsl:apply-templates select="document/header/style"/>
+        <xsl:apply-templates select="document/header/script"/>
+      </head>
+      <body>
+        <div id="body">
+          <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
+            <tr>
+              <td width="50%">
+                <h2>
+                  <xsl:value-of select="document/header/title"/>
+                </h2>
+              </td>
+              <td width="25%">
+                <xsl:apply-templates select="document/header/tab"/>
+              </td>
+            </tr>
+          </table>
+          <p>
+            <xsl:choose>
+              <xsl:when test="document/body/row">
+                <table width="100%">
+                  <xsl:apply-templates select="document/body/*"/>
+                </table>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:apply-templates select="document/body/*"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </p>
+          <p class="copyright">
+            Copyright &#169; 1999-2005 <a href="http://www.apache.org/">The Apache
+              Software Foundation</a>. All rights reserved.
+          </p>
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+  <xsl:template match="style"><link type="text/css" rel="stylesheet" href="{@href}"/>
+  </xsl:template>
+  <xsl:template match="script">
+    <script type="text/javascript" src="{@href}"/>
+  </xsl:template>
+  <xsl:template match="tab"><a href="{@href}">
+    <i>
+      <xsl:value-of select="@title"/>
+    </i></a>&#160;
+  </xsl:template>
+  <xsl:template match="row">
+    <tr>
+      <xsl:apply-templates select="column"/>
+    </tr>
+  </xsl:template>
+  <xsl:template match="column">
+    <td valign="top">
+      <h4 class="samplesGroup">
+        <xsl:value-of select="@title"/>
+      </h4>
+      <p class="samplesText">
+        <xsl:apply-templates/>
+      </p>
+    </td>
+  </xsl:template>
+  <xsl:template match="section">
+    <xsl:choose>
+      <!-- stupid test for the hierarchy depth -->
+      <xsl:when test="../../../section">
+        <h5>
+          <xsl:value-of select="title"/>
+        </h5>
+      </xsl:when>
+      <xsl:when test="../../section">
+        <h4>
+          <xsl:value-of select="title"/>
+        </h4>
+      </xsl:when>
+      <xsl:when test="../section">
+        <h4 class="samplesGroup">
+          <xsl:value-of select="title"/>
+        </h4>
+      </xsl:when>
+    </xsl:choose>
+    <p>
+      <xsl:apply-templates select="*[name()!='title']"/>
+    </p>
+  </xsl:template>
+  <xsl:template match="source">
+    <div style="background: #b9d3ee; border: thin; border-color: black; border-style: solid; padding-left: 0.8em; 
+      padding-right: 0.8em; padding-top: 0px; padding-bottom: 0px; margin: 0.5ex 0px; clear: both;">
+      <pre>
+        <xsl:value-of select="."/>
+      </pre>
+    </div>
+  </xsl:template>
+  <xsl:template match="link">
+    <xsl:text> </xsl:text><a href="{@href}">
+      <xsl:apply-templates/></a>
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:template match="strong">
+    <xsl:text> </xsl:text>
+    <b>
+      <xsl:apply-templates/>
+    </b>
+    <xsl:text> </xsl:text>
+  </xsl:template>
+  <xsl:template match="anchor"><a name="{@name}">
+    <xsl:apply-templates/></a>
+  </xsl:template>
+  <!-- <xsl:template match="table">
+    <table border="1" cellspacing="3" cellpadding="3">
+    <xsl:apply-templates/>
+    </table>
+    </xsl:template> -->
+  <xsl:template match="para">
+    <p>
+      <xsl:apply-templates/>
+    </p>
+  </xsl:template>
+  <xsl:template match="figure">
+    <img src="{@src}" alt=""/>
+  </xsl:template>
+  <xsl:template match="*|@*|node()|text()" priority="-1">
+    <xsl:copy>
+      <xsl:apply-templates select="*|@*|node()|text()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>

Added: lenya/sandbox/modules/forrest/xslt/helper-object.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/xslt/helper-object.xsl?rev=590448&view=auto
==============================================================================
--- lenya/sandbox/modules/forrest/xslt/helper-object.xsl (added)
+++ lenya/sandbox/modules/forrest/xslt/helper-object.xsl Tue Oct 30 13:50:08 2007
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- $Id: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    exclude-result-prefixes="xhtml lenya"
+    >
+
+<xsl:param name="rendertype" select="''"/>
+<xsl:param name="nodeid"/>
+   <!-- this template converts the object tag to img (for compatiblity with older browsers 
+    for more, see http://www.xml.com/pub/a/2003/07/02/dive.html -->
+   <xsl:template name="object2img">
+      <img border="0">
+        <xsl:attribute name="src">
+          <xsl:choose>
+            <xsl:when test="starts-with(@data, 'lenya-document:')">
+              <xsl:value-of select="@data"/>
+            </xsl:when>
+            <xsl:when test="not(starts-with(@data, '/') or starts-with(@data, 'http://'))">
+              <xsl:value-of select="$nodeid"/>/<xsl:value-of select="@data"/>
+            </xsl:when>
+            <xsl:otherwise>            
+              <xsl:value-of select="@data"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:attribute name="alt">
+          <!-- the overwritten title (stored in @name) has precedence over dc:title -->
+          <xsl:choose>
+            <xsl:when test="@name != ''">
+              <xsl:value-of select="@name"/>
+            </xsl:when>
+            <xsl:when test="@title != ''">
+              <xsl:value-of select="@title"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="dc:metadata/dc:title"/>                    
+            </xsl:otherwise>
+            </xsl:choose>
+        </xsl:attribute>
+         <xsl:if test="string(@height)">
+          <xsl:attribute name="height">
+            <xsl:value-of select="@height"/>
+          </xsl:attribute>
+        </xsl:if> 
+        <xsl:if test="string(@width)">
+          <xsl:attribute name="width">
+            <xsl:value-of select="@width"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:if test="@class">
+          <xsl:attribute name="class">
+            <xsl:value-of select="@class"/>
+          </xsl:attribute>
+        </xsl:if>         
+      </img>
+   </xsl:template>
+  
+  <xsl:template match="xhtml:object" priority="3">
+    <xsl:choose>
+      <xsl:when test="@href != ''">
+        <a href="{@href}">
+          <xsl:call-template name="object2img"/>
+        </a>
+      </xsl:when>
+      <xsl:when test="@type = 'application/x-shockwave-flash'">
+        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
+            <param name="movie" value="{$nodeid}/{@data}"/>
+        </object>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object2img"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>  
+
+</xsl:stylesheet> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org