You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2007/05/10 00:02:01 UTC
svn commit: r536678 - 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
Author: reinhard
Date: Wed May 9 15:02:01 2007
New Revision: 536678
URL: http://svn.apache.org/viewvc?view=rev&rev=536678
Log:
- support SitemapComponent docs
- styling for SitemapComponent query (as used in site-22 module)
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?view=diff&rev=536678&r1=536677&r2=536678
==============================================================================
--- 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 Wed May 9 15:02:01 2007
@@ -45,27 +45,10 @@
// documentTypeId == 2 --> SimpleDocument
// documentTypeId == 5 --> CocoonDocument
// documentTypeId == 13 --> NewsItem
- if(documentTypeId == 2 || documentTypeId == 5 || documentTypeId == 13 || documentTypeId == 14) {
- 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()),
- baos,
- new ResourceXsltTransformerSource("org/apache/cocoon/tools/maven/daisy/export/strategy/cocoon-doc-2-xdoc.xslt"),
- params);
- si.data = baos.toByteArray();
-
- si.containsLinksToBeRewritten = true;
- }
-
+ // documentTypeId == 12 --> SitemapComponent
+ if(documentTypeId == 2 || documentTypeId == 5 || 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";
@@ -83,6 +66,27 @@
return null;
}
return si;
+ }
+
+ 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()),
+ baos,
+ new ResourceXsltTransformerSource(stylesheet),
+ params);
+ 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?view=diff&rev=536678&r1=536677&r2=536678
==============================================================================
--- 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 Wed May 9 15:02:01 2007
@@ -77,6 +77,48 @@
</xsl:choose>
</xsl:template>
+ <xsl:template match="d:document[@typeId='12']">
+ <div id="contentBody">
+ <div id="bodyText">
+ <h1 class="docTitle">
+ <xsl:value-of select="@name"/>
+ </h1>
+ <h1>Summary</h1>
+ <xsl:if test="not(d:parts/d:part[@typeId='17']/html/body/*)">
+ <p>No summary available. The summary needs to be defined using the
+ <tt>@cocoon.sitemap.component.documentation</tt>
+ annotation in the Java source file for this component:
+ </p>
+ </xsl:if>
+ <xsl:apply-templates select="d:parts/d:part[@typeId='17']/html/body/*"/>
+ <h1>Basic information</h1>
+ <table>
+ <tr>
+ <th>Component type</th>
+ <td><xsl:value-of select="d:fields/d:field[@name='JavaClassName']/d:string/@valueFormatted"/></td>
+ </tr>
+ <tr>
+ <th>Cocoon block</th>
+ <td><xsl:value-of select="d:fields/d:field[@name='CocoonComponentReference']/d:string/@valueFormatted"/></td>
+ </tr>
+ <tr>
+ <th>Java class</th>
+ <td><xsl:value-of select="d:fields/d:field[@name='CocoonBlock']/d:string/@valueFormatted"/></td>
+ </tr>
+ <tr>
+ <th>Cachable</th>
+ <td><xsl:value-of select="d:fields/d:field[@name='SitemapComponentCacheabilityInfo']/d:string/@valueFormatted"/></td>
+ </tr>
+ </table>
+ <h1>Documentation</h1>
+ <xsl:if test="not(d:parts/d:part[@typeId='18']/html/body/*)">
+ <p>No documentation available yet.</p>
+ </xsl:if>
+ <xsl:apply-templates select="d:parts/d:part[@typeId='18']/html/body/*"/>
+ </div>
+ <xsl:call-template name="addEditUrl"/>
+ </div>
+ </xsl:template>
<!--+
| WebpageWithSidebar (typeId=14)
@@ -310,7 +352,47 @@
</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'"/>
+ </xsl:call-template>
+ <xsl:call-template name="createComponentTable">
+ <xsl:with-param name="type" select="'Transformer'"/>
+ </xsl:call-template>
+ <xsl:call-template name="createComponentTable">
+ <xsl:with-param name="type" select="'Serializer'"/>
+ </xsl:call-template>
+ <xsl:call-template name="createComponentTable">
+ <xsl:with-param name="type" select="'Matcher'"/>
+ </xsl:call-template>
+ <xsl:call-template name="createComponentTable">
+ <xsl:with-param name="type" select="'Selector'"/>
+ </xsl:call-template>
+ <xsl:call-template name="createComponentTable">
+ <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>
+ <table>
+ <tr>
+ <th>Block</th>
+ <th>Name</th>
+ <th></th>
+ </tr>
+ <xsl:for-each select="d:rows/d:row[d:value[1]=$type]">
+ <tr>
+ <td><xsl:value-of select="./d:value[2]"/></td>
+ <td><xsl:value-of select="./d:value[3]"/></td>
+ <td><a href="daisy:{@documentId}">[details]</a></td>
+ </tr>
+ </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
@@ -319,15 +401,15 @@
</xsl:template>
<!--+
- | default templates
- +-->
- <xsl:template match="*|@*|node()" priority="-2">
- <xsl:copy>
+ | default templates
+ +-->
+ <xsl:template match="*|@*|node()" priority="-2">
+ <xsl:copy>
<xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="text()" priority="-1">
+ </xsl:copy>
+ </xsl:template>
+ <xsl:template match="text()" priority="-1">
<xsl:value-of select="."/>
- </xsl:template>
+ </xsl:template>
</xsl:stylesheet>