diff doc/wiki2docbook/html2db/extract-toc.xsl @ 1734:b92fc3c922ac

scripts for converting wiki documentation to docbook
author nadvornik
date Sun, 22 Nov 2009 09:12:22 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/wiki2docbook/html2db/extract-toc.xsl	Sun Nov 22 09:12:22 2009 +0000
@@ -0,0 +1,36 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xalanredirect="org.apache.xalan.xslt.extensions.Redirect"
+                exclude-result-prefixes=""
+                extension-element-prefixes="xalanredirect"
+                xmlns:h="http://www.w3.org/1999/xhtml"
+                version="1.0">
+  
+  <xsl:output method="html"/>
+  
+  <xsl:template match="/">
+    <xsl:apply-templates select="h:html/h:body/*"/>
+  </xsl:template>
+  
+  <xsl:template match="h:div[@class='toc']">
+    <xalanredirect:write file="categories.html">
+      <xsl:apply-templates/>
+    </xalanredirect:write>
+  </xsl:template>
+  
+  <xsl:template match="h:div[@class='toc']//text()[string(.)='Table of Contents']">
+    <xsl:value-of select="/h:html/h:head/h:title/text()"/>
+  </xsl:template>
+  
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+  
+  <xsl:template match="h:a[string()='']">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+      <xsl:text> </xsl:text>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>