[jboss-cvs] JBossAS SVN: r72432 - trunk/docbook-support/jbossorg-docbook-xslt/src/main/resources/xslt/org/jboss.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 18 06:40:39 EDT 2008


Author: newtonm
Date: 2008-04-18 06:40:38 -0400 (Fri, 18 Apr 2008)
New Revision: 72432

Modified:
   trunk/docbook-support/jbossorg-docbook-xslt/src/main/resources/xslt/org/jboss/eclipse.xsl
Log:
Added contents of eclipse/eclipse.xsl to customization layer in order to create plugin.xml and toc.xml.

Modified: trunk/docbook-support/jbossorg-docbook-xslt/src/main/resources/xslt/org/jboss/eclipse.xsl
===================================================================
--- trunk/docbook-support/jbossorg-docbook-xslt/src/main/resources/xslt/org/jboss/eclipse.xsl	2008-04-18 09:36:50 UTC (rev 72431)
+++ trunk/docbook-support/jbossorg-docbook-xslt/src/main/resources/xslt/org/jboss/eclipse.xsl	2008-04-18 10:40:38 UTC (rev 72432)
@@ -11,12 +11,177 @@
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
-  <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.72.0/eclipse/eclipse.xsl"/>
-
-  <!-- We need to override the imported html/chunk.xsl from eclipse/eclipse.xsl to generate valid XHTML -->
+  <!-- We need to replicate the contents of eclipse/eclipse.xsl but import xhtml/chunk.xsl to generate valid XHTML -->
   <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.72.0/xhtml/chunk.xsl"/>
 
+<xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="$rootid != ''">
+      <xsl:choose>
+        <xsl:when test="count(key('id',$rootid)) = 0">
+          <xsl:message terminate="yes">
+            <xsl:text>ID '</xsl:text>
+            <xsl:value-of select="$rootid"/>
+            <xsl:text>' not found in document.</xsl:text>
+          </xsl:message>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$collect.xref.targets = 'yes' or
+                        $collect.xref.targets = 'only'">
+            <xsl:apply-templates select="key('id', $rootid)"
+                        mode="collect.targets"/>
+          </xsl:if>
+          <xsl:if test="$collect.xref.targets != 'only'">
+            <xsl:message>Formatting from <xsl:value-of 
+                            select="$rootid"/></xsl:message>
+            <xsl:apply-templates select="key('id',$rootid)"
+                        mode="process.root"/>
+            <xsl:call-template name="etoc"/>
+            <xsl:call-template name="plugin.xml"/>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:if test="$collect.xref.targets = 'yes' or
+                    $collect.xref.targets = 'only'">
+        <xsl:apply-templates select="/" mode="collect.targets"/>
+      </xsl:if>
+      <xsl:if test="$collect.xref.targets != 'only'">
+        <xsl:apply-templates select="/" mode="process.root"/>
+        <xsl:call-template name="etoc"/>
+        <xsl:call-template name="plugin.xml"/>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+
+
+</xsl:template>
+
+<xsl:template name="etoc">
+  <xsl:call-template name="write.chunk">
+    <xsl:with-param name="filename">
+      <xsl:if test="$manifest.in.base.dir != 0">
+        <xsl:value-of select="$base.dir"/>
+      </xsl:if>
+      <xsl:value-of select="'toc.xml'"/>
+    </xsl:with-param>
+    <xsl:with-param name="method" select="'xml'"/>
+    <xsl:with-param name="encoding" select="'utf-8'"/>
+    <xsl:with-param name="indent" select="'yes'"/>
+    <xsl:with-param name="content">
+      <xsl:choose>
+
+        <xsl:when test="$rootid != ''">
+          <xsl:variable name="title">
+            <xsl:if test="$eclipse.autolabel=1">
+              <xsl:variable name="label.markup">
+                <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
+              </xsl:variable>
+              <xsl:if test="normalize-space($label.markup)">
+                <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+              </xsl:if>
+            </xsl:if>
+            <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
+          </xsl:variable>
+          <xsl:variable name="href">
+            <xsl:call-template name="href.target.with.base.dir">
+              <xsl:with-param name="object" select="key('id',$rootid)"/>
+            </xsl:call-template>
+          </xsl:variable>
+          
+          <toc label="{$title}" topic="{$href}">
+            <xsl:apply-templates select="key('id',$rootid)/*" mode="etoc"/>
+          </toc>
+        </xsl:when>
+
+        <xsl:otherwise>
+          <xsl:variable name="title">
+            <xsl:if test="$eclipse.autolabel=1">
+              <xsl:variable name="label.markup">
+                <xsl:apply-templates select="/*" mode="label.markup"/>
+              </xsl:variable>
+              <xsl:if test="normalize-space($label.markup)">
+                <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+              </xsl:if>
+            </xsl:if>
+            <xsl:apply-templates select="/*" mode="title.markup"/>
+          </xsl:variable>
+          <xsl:variable name="href">
+            <xsl:call-template name="href.target.with.base.dir">
+              <xsl:with-param name="object" select="/"/>
+            </xsl:call-template>
+          </xsl:variable>
+          
+          <toc label="{$title}" topic="{$href}">
+            <xsl:apply-templates select="/*/*" mode="etoc"/>
+          </toc>
+        </xsl:otherwise>
+
+      </xsl:choose>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc">
+  <xsl:variable name="title">
+    <xsl:if test="$eclipse.autolabel=1">
+      <xsl:variable name="label.markup">
+        <xsl:apply-templates select="." mode="label.markup"/>
+      </xsl:variable>
+      <xsl:if test="normalize-space($label.markup)">
+        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
+      </xsl:if>
+    </xsl:if>
+    <xsl:apply-templates select="." mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:variable name="href">
+    <xsl:call-template name="href.target.with.base.dir">
+      <xsl:with-param name="context" select="/"/>        <!-- Generate links relative to the location of root file/toc.xml file -->
+    </xsl:call-template>
+  </xsl:variable>
+
+  <topic label="{$title}" href="{$href}">
+    <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/>
+  </topic>
+
+</xsl:template>
+
+<xsl:template match="text()" mode="etoc"/>
+
+<xsl:template name="plugin.xml">
+  <xsl:call-template name="write.chunk">
+    <xsl:with-param name="filename">
+      <xsl:if test="$manifest.in.base.dir != 0">
+        <xsl:value-of select="$base.dir"/>
+      </xsl:if>
+      <xsl:value-of select="'plugin.xml'"/>
+    </xsl:with-param>
+    <xsl:with-param name="method" select="'xml'"/>
+    <xsl:with-param name="encoding" select="'utf-8'"/>
+    <xsl:with-param name="indent" select="'yes'"/>
+    <xsl:with-param name="content">
+      <plugin name="{$eclipse.plugin.name}"
+        id="{$eclipse.plugin.id}"
+        version="1.0"
+        provider-name="{$eclipse.plugin.provider}">
+
+        <extension point="org.eclipse.help.toc">
+          <toc file="toc.xml" primary="true"/>
+        </extension>
+          
+      </plugin>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+  <!-- Now we can carry on with our XSL customization layer -->
   <xsl:include href="xhtml-common.xsl"/>
+  
+  <xsl:param name="eclipse.plugin.name">JBoss Community Help</xsl:param>
+  <xsl:param name="eclipse.plugin.id">org.jboss.help</xsl:param>
+  <xsl:param name="eclipse.plugin.provider">JBoss.org</xsl:param>
 
   <!-- We don't want to display titles in the header navigation as there are already breadcrumbs -->
   <xsl:param name="navig.showtitles" select="0"/>




More information about the jboss-cvs-commits mailing list