forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r328599 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer: ./ resources/stylesheets/helper/ resources/stylesheets/html/ resources/stylesheets/to-xml/
Date Wed, 26 Oct 2005 09:06:31 GMT
Author: thorsten
Date: Wed Oct 26 02:06:20 2005
New Revision: 328599

URL: http://svn.apache.org/viewcvs?rev=328599&view=rev
Log:
Fixed the toc generation by basing it on the same code for *.toc.xml and *.body.xml. Based
the body again on the *.source.rewritten.xml. Extract the id generation code into a helper
class

Added:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
  (with props)
Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/dataModel.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/internal.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/linkmap.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/html/document2html.xsl
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/to-xml/document2toc.xsl

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/dataModel.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/dataModel.xmap?rev=328599&r1=328598&r2=328599&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/dataModel.xmap
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/dataModel.xmap
Wed Oct 26 02:06:20 2005
@@ -44,7 +44,7 @@
     <map:pipeline>
       <!-- HTML rendered from intermediate format -->
       <map:match pattern="**.body.xml">
-        <map:generate src="cocoon://{1}.xml" />
+        <map:generate src="cocoon:/{1}.source.rewritten.xml" />
         <map:transform src="{lm:dataModel-html-document2html.xsl}">
           <map:parameter name="path" value="{1}.html" />
         </map:transform>

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/internal.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/internal.xmap?rev=328599&r1=328598&r2=328599&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/internal.xmap
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/internal.xmap
Wed Oct 26 02:06:20 2005
@@ -225,7 +225,7 @@
         <map:transform src="cocoon:/structurer-xsl.html.{1}">
           <map:parameter name="path" value="{0}" />
         </map:transform>
-        <!-- <map:transform src="resources/stylesheets/strip_namespaces.xsl" />
-->
+         <map:transform src="{lm:transform.xml.xml-namespace-stripped}" /> 
         <map:serialize type="xhtml" />
       </map:match>
     </map:pipeline>

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/linkmap.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/linkmap.xmap?rev=328599&r1=328598&r2=328599&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/linkmap.xmap
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/linkmap.xmap
Wed Oct 26 02:06:20 2005
@@ -49,6 +49,24 @@
         </map:transform>
         <map:serialize />
       </map:match>
+       <!-- site.xml with @href's appended to be context-relative. -->
+      <map:match pattern="abs-linkmap">
+			  <map:select type="exists">
+          <map:when test="{project:content.xdocs}site.xml">
+            <map:generate src="{project:content.xdocs}site.xml"/>
+          </map:when>
+          <map:when test="{lm:site.xml}">
+            <map:generate src="{lm:site.xml}"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="{project:content.xdocs}site.xml"/>
+          </map:otherwise>
+        </map:select>
+        <map:transform type="xinclude"/>
+        <map:transform src="{lm:transform.xml.xml-namespace-stripped}" />
+	<map:transform src="{lm:transform.linkmap.linkmap-absolutized}" />
+        <map:serialize type="xml" />
+      </map:match>
     </map:pipeline>
   </map:pipelines>
 

Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl?rev=328599&view=auto
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
(added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
Wed Oct 26 02:06:20 2005
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2005 The Apache Software Foundation or its licensors,
+  as applicable.
+
+  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.
+-->
+<!--
+This stylesheet contains templates for converting documentv11 to HTML.  See the
+imported document2html.xsl for details.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!--  Templates for "toc" mode.  This will generate a complete
+        Table of Contents for the document.  This will then be used
+        by the site2xhtml to generate a Menu ToC and a Page ToC -->
+  
+  <xsl:template name="generate-id">
+    <xsl:choose>
+      <xsl:when test="@id">
+        <xsl:value-of select="@id"/>
+      </xsl:when>
+      <xsl:when test="title">
+        <xsl:value-of select="title"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="generate-id(.)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>

Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/helper/generateId.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/html/document2html.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/html/document2html.xsl?rev=328599&r1=328598&r2=328599&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/html/document2html.xsl
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/html/document2html.xsl
Wed Oct 26 02:06:20 2005
@@ -21,9 +21,8 @@
 -->
 
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
   <xsl:import href="../common/xslt/html/document2html.xsl"/>
-
+  <xsl:include href="../helper/generateId.xsl"/>
   <xsl:template match="document">
     <div id="content">
       <xsl:if test="normalize-space(header/title)!=''">
@@ -50,79 +49,94 @@
         <xsl:apply-templates select="header/version"/>
       </div>
     -->
-      
       <div id="content-main">
         <xsl:apply-templates select="body"/>
       </div>
     </div>
   </xsl:template>
-
   <xsl:template match="body">
     <xsl:apply-templates/>
   </xsl:template>
-  
-  
-  <xsl:template match="@id">
-    <xsl:apply-imports/>
+    <xsl:template name="tocLinkGenerator">
+      <a>
+      <xsl:attribute name="name"><xsl:call-template 
+        name="generate-id"/></xsl:attribute>
+      <xsl:attribute name="title">
+        <xsl:value-of select="title"/>
+      </xsl:attribute><xsl:text> </xsl:text>
+    </a>
   </xsl:template>
+  <!--<xsl:template match="@id">
+    <xsl:apply-imports/>
+  </xsl:template>-->
   <!-- Generate a <a name="..."> tag for an @id -->
-  <xsl:template match="@id">
+  <!--<xsl:template match="@id">
     <xsl:if test="normalize-space(.)!=''">
-      <a name="{.}"><xsl:text> </xsl:text></a>
+      <a name="{.}">&#160;</a>
     </xsl:if>
-  </xsl:template>
+  </xsl:template>-->
   <xsl:template match="section">
-    <a name="{generate-id()}"><xsl:text> </xsl:text></a>
-    <xsl:apply-templates select="@id"/>
-
+    <xsl:call-template name="tocLinkGenerator"/>
+   <!-- <xsl:apply-templates select="@id"/>-->
     <xsl:variable name = "level" select = "count(ancestor::section)+1" />
-
     <xsl:choose>
       <xsl:when test="$level=1">
         <div class="skinconf-heading-{$level}">
-          <h1><xsl:value-of select="title"/></h1>
+          <h1>
+            <xsl:value-of select="title"/>
+          </h1>
         </div>
         <div class="section">
-      <xsl:apply-templates select="*[not(self::title)]"/>
-    </div>  
+          <xsl:apply-templates select="*[not(self::title)]"/>
+        </div>
       </xsl:when>
       <xsl:when test="$level=2">
         <div class="skinconf-heading-{$level}">
-          <h2><xsl:value-of select="title"/></h2>
+          <h2>
+            <xsl:value-of select="title"/>
+          </h2>
         </div>
         <xsl:apply-templates select="*[not(self::title)]"/>
       </xsl:when>
       <!-- If a faq, answer sections will be level 3 (1=Q/A, 2=part) -->
       <xsl:when test="$level=3 and $notoc='true'">
-        <h4 class="faq"><xsl:value-of select="title"/></h4>
-        <div align="right"><a href="#{@id}-menu">^</a></div>
+        <h4 class="faq">
+          <xsl:value-of select="title"/>
+        </h4>
+        <div align="right">
+          <a href="#{@id}-menu">^</a>
+        </div>
         <div style="margin-left: 15px">
           <xsl:apply-templates select="*[not(self::title)]"/>
         </div>
       </xsl:when>
       <xsl:when test="$level=3">
-        <h4><xsl:value-of select="title"/></h4>
+        <h4>
+          <xsl:value-of select="title"/>
+        </h4>
         <xsl:apply-templates select="*[not(self::title)]"/>
-
       </xsl:when>
-
       <xsl:otherwise>
-        <h5><xsl:value-of select="title"/></h5>
+        <h5>
+          <xsl:value-of select="title"/>
+        </h5>
         <xsl:apply-templates select="*[not(self::title)]"/>
       </xsl:otherwise>
     </xsl:choose>
-
-  </xsl:template>  
-  
+  </xsl:template>
   <xsl:template match="figure">
     <xsl:apply-templates select="@id"/>
     <div style="text-align: center;">
       <img src="{@src}" alt="{@alt}" class="figure">
         <xsl:if test="@height">
-          <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+          <xsl:attribute name="height">
+            <xsl:value-of select="@height"/>
+          </xsl:attribute>
         </xsl:if>
         <xsl:if test="@width">
-          <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
+          <xsl:attribute name="width">
+            <xsl:value-of select="@width"/>
+          </xsl:attribute>
         </xsl:if>
       </img>
     </div>
@@ -133,10 +147,13 @@
       <div class="label">
         <xsl:choose>
           <!-- FIXME: i18n Transformer here -->
-          <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
+          <xsl:when test="@label">
+            <xsl:value-of select="@label"/>
+          </xsl:when>
           <xsl:when test="local-name() = 'note'">Note</xsl:when>
           <xsl:when test="local-name() = 'warning'">Warning</xsl:when>
-          <xsl:otherwise>Fixme (<xsl:value-of select="@author"/>)</xsl:otherwise>
+          <xsl:otherwise>Fixme (<xsl:value-of 
+            select="@author"/>)</xsl:otherwise>
         </xsl:choose>
       </div>
       <div class="content">

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/to-xml/document2toc.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/to-xml/document2toc.xsl?rev=328599&r1=328598&r2=328599&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/to-xml/document2toc.xsl
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/to-xml/document2toc.xsl
Wed Oct 26 02:06:20 2005
@@ -21,10 +21,10 @@
 -->
 
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:include href="../helper/generateId.xsl"/>
   <!--  Templates for "toc" mode.  This will generate a complete
         Table of Contents for the document.  This will then be used
         by the site2xhtml to generate a Menu ToC and a Page ToC -->
-  
   <xsl:template match="document">
     <xsl:apply-templates mode="toc"/>
   </xsl:template>
@@ -47,19 +47,6 @@
         <xsl:with-param name="level" select="$level+1"/>
       </xsl:apply-templates>
     </tocitem>
-  </xsl:template>
-  <xsl:template name="generate-id">
-    <xsl:choose>
-      <xsl:when test="@id">
-        <xsl:value-of select="@id"/>
-      </xsl:when>
-      <xsl:when test="@title">
-        <xsl:value-of select="@title"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="generate-id(.)"/>
-      </xsl:otherwise>
-    </xsl:choose>
   </xsl:template>
   <xsl:template match="node()|@*" mode="toc"/>
 </xsl:stylesheet>



Mime
View raw message