summaryrefslogtreecommitdiff
path: root/docs/html-to-website-xml.xsl
diff options
context:
space:
mode:
authorSimon MacMullen <simon@lshift.net>2010-02-26 12:25:34 +0000
committerSimon MacMullen <simon@lshift.net>2010-02-26 12:25:34 +0000
commit875933a3b2a783a4d06a5b7ce0d6effa556fae9f (patch)
treec88c38abb5d93f1eccb0ba1b8a0bc516799dee2e /docs/html-to-website-xml.xsl
parent18a9b92d531f166b705956f73f24472308551349 (diff)
downloadrabbitmq-server-git-875933a3b2a783a4d06a5b7ce0d6effa556fae9f.tar.gz
Transform our generated rabbitmqctl HTML page back to our ad-hoc XML format for the website. It looks OK now.
Diffstat (limited to 'docs/html-to-website-xml.xsl')
-rw-r--r--docs/html-to-website-xml.xsl68
1 files changed, 68 insertions, 0 deletions
diff --git a/docs/html-to-website-xml.xsl b/docs/html-to-website-xml.xsl
new file mode 100644
index 0000000000..d4cee0856b
--- /dev/null
+++ b/docs/html-to-website-xml.xsl
@@ -0,0 +1,68 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:doc="http://www.rabbitmq.com/namespaces/ad-hoc/doc"
+ version='1.0'>
+
+<xsl:output method="xml" doctype-public="bug in xslt processor requires fake doctype" doctype-system="otherwise css isn't included" />
+
+<xsl:template match="*"/>
+
+<!-- Copy every element through, deliberately losing all attributes -->
+<xsl:template match="node()" mode="copy">
+ <xsl:copy><xsl:apply-templates select="node()" mode="copy"/></xsl:copy>
+</xsl:template>
+
+<!-- Copy the root node, and munge the outer part of the page -->
+<xsl:template match="/html">
+<xsl:processing-instruction name="xml-stylesheet">type="text/xml" href="page.xsl"</xsl:processing-instruction>
+<html xmlns:doc="http://www.rabbitmq.com/namespaces/ad-hoc/doc">
+ <head>
+ <title>rabbitmqctl(1) manual page</title>
+ </head>
+ <body>
+ <doc:div>
+ <p>
+ This is the manual page for the <code>rabbitmqctl</code> command. For
+ more general documentation, please see the
+ <a href="admin-guide.html">administrator's guide</a>.
+ </p>
+
+ <doc:toc class="compact">
+ <doc:heading>Table of Contents</doc:heading>
+ </doc:toc>
+
+ <xsl:apply-templates select="body/div[@class='refentry']" mode="copy"/>
+ </doc:div>
+ </body>
+</html>
+</xsl:template>
+
+<!-- Specific instructions to revert the DocBook HTML to be more like our ad-hoc XML schema -->
+
+<xsl:template match="div[@class='refsect1'] | div[@class='refnamediv'] | div[@class='refsynopsisdiv']" mode="copy">
+ <doc:section name="{@title}">
+ <xsl:apply-templates select="node()" mode="copy"/>
+ </doc:section>
+</xsl:template>
+
+<xsl:template match="div[@class='refsect2']" mode="copy">
+ <doc:subsection name="{@title}">
+ <xsl:apply-templates select="node()" mode="copy"/>
+ </doc:subsection>
+</xsl:template>
+
+<xsl:template match="h2 | h3" mode="copy">
+ <doc:heading>
+ <xsl:apply-templates select="node()" mode="copy"/>
+ </doc:heading>
+</xsl:template>
+
+<xsl:template match="pre[@class='screen']" mode="copy">
+ <pre class="sourcecode">
+ <xsl:apply-templates select="node()" mode="copy"/>
+ </pre>
+</xsl:template>
+
+
+</xsl:stylesheet>
+