cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r570263 - in /cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main: java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
Date Mon, 27 Aug 2007 22:34:20 GMT
Author: reinhard
Date: Mon Aug 27 15:34:17 2007
New Revision: 570263

URL: http://svn.apache.org/viewvc?rev=570263&view=rev
Log:
add formatting for sitemaelements

Modified:
    cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
    cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt

Modified: cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java?rev=570263&r1=570262&r2=570263&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
(original)
+++ cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/java/org/apache/cocoon/tools/maven/daisy/export/strategy/CocoonExportStrategy.java
Mon Aug 27 15:34:17 2007
@@ -1,8 +1,8 @@
 /*
  * Licensed to the Outerthought bvba and Schaubroeck NV under one
  * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information regarding 
- * copyright ownership.  Outerthought bvba and Schaubroeck NV license 
+ * distributed with this work for additional information regarding
+ * copyright ownership.  Outerthought bvba and Schaubroeck NV license
  * 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
@@ -14,7 +14,7 @@
  * "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. 
+ * under the License.
  */
 package org.apache.cocoon.tools.maven.daisy.export.strategy;
 
@@ -35,34 +35,34 @@
 import org.outerj.daisy.repository.RepositoryException;
 
 public class CocoonExportStrategy extends DefaultExportStrategy {
-    
+
     public StreamingInformation createStreamingInformation(DaisyDocument doc, String editUrl,
String author, Log log) {
-        long documentTypeId = doc.getDocument().getDocumentTypeId();     
-        StreamingInformation si = new StreamingInformation();     
-        
+        long documentTypeId = doc.getDocument().getDocumentTypeId();
+        StreamingInformation si = new StreamingInformation();
+
         si.originalData = doc.asByteArray();
-        
+
         //   documentTypeId ==  2 --> SimpleDocument
         //   documentTypeId ==  5 --> CocoonDocument
         //   documentTypeId == 13 --> NewsItem
         //   documentTypeId == 12 --> SitemapComponent
-        if(documentTypeId == 2 || documentTypeId == 5 || documentTypeId == 12 || documentTypeId
== 13 || documentTypeId == 14) {
+        if(documentTypeId == 2 || documentTypeId == 5 || documentTypeId == 10 || documentTypeId
== 12 || documentTypeId == 13 || documentTypeId == 14) {
             transformDocument(doc, editUrl, author, si, "org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt");
-        } 
+        }
         //   documentTypeId ==  3 --> Image
         else if(documentTypeId == 3) {
             si.relativeName = PATH_RESOURCES_IMAGES + DaisyDocumentProxy.createUniqeFileName(doc)
+ ".img";
             try {
                 si.data = doc.getDocument().getPart(3).getData();
             } catch (PartNotFoundException e) {
-                throw new DaisyClientException("Problems occurred while accessing part id=3
of document id=" 
+                throw new DaisyClientException("Problems occurred while accessing part id=3
of document id="
                         + doc.getDocId() + "'.", e);
             } catch (RepositoryException e) {
                 throw new DaisyClientException("Problems occurred while accessing the Daisy
repository.", e);
             }
         }
         else {
-            log.warn("Document id=" + doc.getDocId() + " not streamed because there is no
available serialization strategy. documentTypeId=" + documentTypeId);  
+            log.warn("Document id=" + doc.getDocId() + " not streamed because there is no
available serialization strategy. documentTypeId=" + documentTypeId);
             return null;
         }
         return si;
@@ -71,21 +71,21 @@
     private void transformDocument(DaisyDocument doc, String editUrl, String author, StreamingInformation
si, String stylesheet) {
         si.relativeName = PATH_XDOCS + DaisyDocumentProxy.createUniqeFileName(doc) + ".xml";
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        
+
         Map params = new HashMap();
         params.put("editUrl", editUrl + doc.getDocId() + "?branch=" + doc.getBranchId() +
"&language=" + doc.getLanguageId());
         if(author != null) {
             params.put("author", author);
             params.put("documentName", doc.getDocument().getName());
         }
-        
+
         XMLUtils.transform(
-                new ByteArrayInputStream(doc.asByteArray()), 
+                new ByteArrayInputStream(doc.asByteArray()),
                 baos,
                 new ResourceXsltTransformerSource(stylesheet),
                 params);
-        si.data = baos.toByteArray();  
-        
+        si.data = baos.toByteArray();
+
         si.containsLinksToBeRewritten = true;
     }
 

Modified: cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt?rev=570263&r1=570262&r2=570263&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
(original)
+++ cocoon/trunk/tools/cocoon-daisy-export-strategy/src/main/resources/org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt
Mon Aug 27 15:34:17 2007
@@ -2,7 +2,7 @@
 <!--
  Licensed to the Outerthought bvba and Schaubroeck NV under one
  or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding 
+ distributed with this work for additional information regarding
  copyright ownership.  Outerthought bvba and Schaubroeck NV license
  this file to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
@@ -15,21 +15,21 @@
  "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. 
+ under the License.
 -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
   xmlns:p="http://outerx.org/daisy/1.0#publisher" xmlns:d="http://outerx.org/daisy/1.0"
   xmlns:ns="http://outerx.org/daisy/1.0" exclude-result-prefixes="p d ns">
-  
+
   <xsl:output method="xml"/>
   <xsl:output omit-xml-declaration="no"/>
-  
+
   <xsl:preserve-space elements="pre"/>
-  
+
   <xsl:param name="author"/>
   <xsl:param name="documentName"/>
   <xsl:param name="editUrl"/>
-  
+
   <xsl:template match="/">
     <document>
       <properties>
@@ -47,7 +47,7 @@
       </body>
     </document>
   </xsl:template>
-  
+
   <!--+
       | CocoonDocument (typeId=5)
       | SimpleDocument (typeId=2)
@@ -76,7 +76,31 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-  
+
+  <!-- Sitemap elements -->
+  <xsl:template match="d:document[@typeId='10']">
+    <div id="contentBody">
+      <div id="bodyText">
+        <h1 class="docTitle">
+          <xsl:value-of select="@name"/>
+        </h1>
+        <xsl:apply-templates select="d:parts/d:part[@typeId='19']/html/body/*"/>
+        <h1>Attributes</h1>
+        <xsl:apply-templates select="d:parts/d:part[@typeId='16']/html/body/*"/>
+        <h1>Occurence</h1>
+        <h2>Children</h2>
+        <p>This element can have the following children:</p>
+        <ul>
+          <xsl:for-each select="d:fields/d:field[@name='SitemapElementChildren']/d:link">
+            <li><xsl:value-of select="@valueFormatted"/></li>
+          </xsl:for-each>
+        </ul>
+      </div>
+      <xsl:call-template name="addEditUrl"/>
+    </div>
+  </xsl:template>
+
+  <!-- Sitemap components -->
   <xsl:template match="d:document[@typeId='12']">
     <div id="contentBody">
       <div id="bodyText">
@@ -126,7 +150,7 @@
       <xsl:call-template name="addEditUrl"/>
     </div>
   </xsl:template>
-  
+
   <!--+
       | WebpageWithSidebar (typeId=14)
       | - Sidebar (part Id=19)
@@ -193,7 +217,7 @@
       </div>
     </div>
   </xsl:template>
-  
+
   <!--+
       | Add link to Daisy page at the bottom of each page
       +-->
@@ -206,9 +230,9 @@
       </div>
     </div>
   </xsl:template>
-  
+
   <!--+
-      | Work-around for tables as the Maven site plugin changes the attributes of 
+      | Work-around for tables as the Maven site plugin changes the attributes of
       | table, tr and td.
       +-->
   <xsl:template match="table[@daisy-table-type]">
@@ -246,7 +270,7 @@
       </table>
     </div>
   </xsl:template>
-  
+
   <!--+
       | Includes
       |
@@ -259,13 +283,13 @@
         $id]/p:publisherResponse/d:document"/>
     </div>
   </xsl:template>
-  
+
   <!-- images -->
   <xsl:template match="img">
     <img src="{@src}" width="{@p:imageWidth}" height="{@p:imageHeight}" name="{p:linkInfo/@documentName}"
       alt="{p:linkInfo/@documentName}"/>
   </xsl:template>
-  
+
   <!-- links: remove p:linkInfo -->
   <xsl:template match="a/p:linkInfo"/>
   <xsl:template match="pre">
@@ -274,7 +298,7 @@
         <xsl:apply-templates/>
       </pre>
   </xsl:template>
-  
+
   <!-- surround all p elements that have an attribute to some div equivalent -->
   <xsl:template match="p[@class='warning']">
     <div class="warning">
@@ -300,7 +324,7 @@
       </div>
     </div>
   </xsl:template>
-  
+
   <!-- format search results -->
   <xsl:template match="d:searchResult[@styleHint='news']">
     <div class="news">
@@ -317,7 +341,7 @@
       </xsl:for-each>
     </div>
   </xsl:template>
-  
+
   <xsl:template match="d:searchResult[@styleHint='sitemap-components']">
     <xsl:call-template name="createComponentTable">
       <xsl:with-param name="type" select="'Generator'"/>
@@ -338,7 +362,7 @@
       <xsl:with-param name="type" select="'Action'"/>
     </xsl:call-template>
   </xsl:template>
-  
+
   <xsl:template name="createComponentTable">
     <xsl:param name="type"/>
     <h1><xsl:value-of select="$type"/>s</h1>
@@ -363,13 +387,13 @@
       </xsl:for-each>
     </table>
   </xsl:template>
-  
+
   <xsl:template match="d:searchResult">
     <div class="warning">
       <strong style="color:red;font-weight:bold">Warning: There is no styling for this
query available.</strong>
     </div>
   </xsl:template>
-  
+
   <!--+
        | default templates
        +-->



Mime
View raw message