]> git.draconx.ca Git - homepage.git/blobdiff - layouts/gpl.xsl
Put some actual material on the site.
[homepage.git] / layouts / gpl.xsl
diff --git a/layouts/gpl.xsl b/layouts/gpl.xsl
new file mode 100644 (file)
index 0000000..23bdfe4
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+  Nick's web site: GNU license reformatter.
+
+  This tool implements any fixes required to ensure the GNU licenses are
+  formatted correctly for the web site.  Since the license sources are
+  originally in markdown format very little post-processing is required.
+
+  Copyright © 2019 Nick Bowler
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <https://www.gnu.org/licenses/>
+-->
+<xsl:stylesheet version='1.0'
+  xmlns='http://www.w3.org/1999/xhtml'
+  xmlns:xhtml='http://www.w3.org/1999/xhtml'
+  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+  exclude-result-prefixes='xhtml'>
+<xsl:output method='xml' encoding='UTF-8'
+  omit-xml-declaration='yes' indent='no' />
+
+<xsl:template match='node()|@*'>
+  <xsl:copy><xsl:apply-templates select='node()|@*' /></xsl:copy>
+</xsl:template>
+
+<xsl:template match='//xhtml:h2[1]' />
+
+<xsl:template match='xhtml:ul'>
+  <xsl:copy>
+    <xsl:attribute name='class'>ordered</xsl:attribute>
+    <xsl:apply-templates select='node()|@*' />
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match='xhtml:li'>
+  <xsl:copy>
+    <xsl:apply-templates select='@*' />
+    <p><xsl:apply-templates select='node()' /></p>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match='xhtml:li/node()[1][self::text()]'>
+  <xsl:variable name='text' select='normalize-space(.)' />
+  <span><xsl:value-of select='substring-before($text, " ")' />&#xa0;</span>
+  <xsl:value-of select='substring-after($text, " ")' />
+</xsl:template>
+
+</xsl:stylesheet>