aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--datasource.xsl38
-rw-r--r--datasource/entry.xsl33
-rw-r--r--generate.xsl42
-rw-r--r--meta.xml12
-rw-r--r--result.xsl48
-rw-r--r--source/pages/about.md9
-rw-r--r--source/pages/contact.md5
-rw-r--r--template/master.xsl64
-rw-r--r--template/page.xsl23
-rw-r--r--utility/formatter.xsl20
-rw-r--r--utility/generator.xsl22
-rw-r--r--utility/reader.xsl16
-rw-r--r--utility/transformer.xsl20
-rw-r--r--utility/writer.xsl20
14 files changed, 372 insertions, 0 deletions
diff --git a/datasource.xsl b/datasource.xsl
new file mode 100644
index 0000000..698ca67
--- /dev/null
+++ b/datasource.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="no"
+ encoding="UTF-8"
+ indent="yes"
+/>
+
+<xsl:include href="utility/reader.xsl"/>
+<xsl:include href="datasource/entry.xsl"/>
+
+<xsl:template match="data/source">
+ <datasource>
+ <xsl:apply-templates select="@*|node()"/>
+ </datasource>
+</xsl:template>
+
+<xsl:template match="source/pages">
+ <pages>
+ <xsl:apply-templates select="./*"/>
+ </pages>
+</xsl:template>
+
+<xsl:template match="file[./extension = '.md']">
+ <xsl:call-template name="entry">
+ <xsl:with-param name="file" select="."/>
+ </xsl:call-template>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/datasource/entry.xsl b/datasource/entry.xsl
new file mode 100644
index 0000000..4ea6162
--- /dev/null
+++ b/datasource/entry.xsl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:include href="[utility/formatter.xsl]"/>
+
+<xsl:template name="entry">
+ <xsl:param name="file"/>
+
+ <entry handle="{$file/name}">
+ <xsl:choose>
+ <xsl:when test="$file/extension = '.md'">
+ <xsl:call-template name="formatter">
+ <xsl:with-param name="format">/usr/bin/markdown</xsl:with-param>
+ <xsl:with-param name="source" select="InputXSLT:read-file($file/full)/text()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$file/extension = '.xml'">
+ <xsl:copy-of select="InputXSLT:read-file($file/full)/*"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="InputXSLT:read-file($file/full)/text()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/generate.xsl b/generate.xsl
new file mode 100644
index 0000000..cba8bea
--- /dev/null
+++ b/generate.xsl
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="yes"
+ encoding="UTF-8"
+ indent="yes"
+/>
+
+<xsl:include href="utility/transformer.xsl"/>
+
+<xsl:template match="meta">
+ <xsl:call-template name="transformer">
+ <xsl:with-param name="input">
+ <data>
+ <xsl:copy-of select="."/>
+ <xsl:call-template name="transformer">
+ <xsl:with-param name="input">
+ <data>
+ <xsl:copy-of select="."/>
+ <xsl:call-template name="transformer">
+ <xsl:with-param name="input" select="."/>
+ <xsl:with-param name="transformation">[source.xsl]</xsl:with-param>
+ </xsl:call-template>
+ </data>
+ </xsl:with-param>
+ <xsl:with-param name="transformation">[datasource.xsl]</xsl:with-param>
+ </xsl:call-template>
+ </data>
+ </xsl:with-param>
+ <xsl:with-param name="transformation">[result.xsl]</xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/meta.xml b/meta.xml
new file mode 100644
index 0000000..3d6fcbc
--- /dev/null
+++ b/meta.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<meta>
+ <title>/home/adrian</title>
+ <base>/home/common/projects/dev/static_site_generator</base>
+ <target>
+ <url>/home/common/projects/dev/static_site_generator/result</url>
+ <directory>/home/common/projects/dev/static_site_generator/result</directory>
+ </target>
+ <source>
+ <directory>/home/common/projects/dev/static_site_generator/source</directory>
+ </source>
+</meta>
diff --git a/result.xsl b/result.xsl
new file mode 100644
index 0000000..1597664
--- /dev/null
+++ b/result.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="no"
+ encoding="UTF-8"
+ indent="yes"
+/>
+
+<xsl:include href="utility/generator.xsl"/>
+
+<xsl:variable name="meta" select="/data/meta"/>
+
+<xsl:template match="data/datasource">
+ <result>
+ <xsl:apply-templates select="@*|node()"/>
+ </result>
+</xsl:template>
+
+<xsl:template match="datasource/pages">
+ <pages>
+ <xsl:apply-templates select="./*"/>
+ </pages>
+</xsl:template>
+
+<xsl:template match="pages/entry">
+ <xsl:call-template name="generator">
+ <xsl:with-param name="input">
+ <data>
+ <xsl:copy-of select="$meta"/>
+ <xsl:copy-of select="."/>
+ </data>
+ </xsl:with-param>
+ <xsl:with-param name="transformation">[template/page.xsl]</xsl:with-param>
+ <xsl:with-param name="target">
+ <xsl:value-of select="$meta/target/directory"/>/pages/<xsl:value-of select="./@handle"/>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/pages/about.md b/source/pages/about.md
new file mode 100644
index 0000000..827b612
--- /dev/null
+++ b/source/pages/about.md
@@ -0,0 +1,9 @@
+# About
+
+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
+
+* Lorem ipsum dolor sit amet
+* consetetur sadipscing elitr
+* sed diam nonumy eirmod tempor
+
+Invidunt ut *labore* et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
diff --git a/source/pages/contact.md b/source/pages/contact.md
new file mode 100644
index 0000000..a9d8be1
--- /dev/null
+++ b/source/pages/contact.md
@@ -0,0 +1,5 @@
+# Contact
+
+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
+
+Invidunt ut *labore* et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
diff --git a/template/master.xsl b/template/master.xsl
new file mode 100644
index 0000000..e2b77b4
--- /dev/null
+++ b/template/master.xsl
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:output
+ method="xml"
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ omit-xml-declaration="yes"
+ encoding="UTF-8"
+ indent="yes"
+/>
+
+<xsl:template match="data">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="author" content="Adrian Kummerländer" />
+ <meta name="robots" content="all"/>
+ <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
+
+ <title><xsl:call-template name="title-text"/></title>
+ <link rel="stylesheet" type="text/css" href="{/meta/target/url}/main.css" />
+
+ <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
+</head>
+<body>
+ <div id="wrapper">
+ <div id="content">
+ <div id="nav_wrap">
+ <h1><xsl:value-of select="meta/title"/></h1>
+ <ul>
+ <li><a href="{/meta/target/url}">Start</a></li>
+ <li><a href="{/meta/target/url}/archiv">Archiv</a></li>
+ <li><a href="{/meta/target/url}/projekte">Projekte</a></li>
+ <li><a href="{/meta/target/url}/seiten/kontakt">Kontakt</a></li>
+ <li class="last_item"><a href="{/meta/target/url}/rss">RSS</a></li>
+ </ul>
+ </div>
+ <div id="main">
+ <xsl:apply-templates select="/entry"/>
+ </div>
+ <div id="footer_wrap">
+ </div>
+ <div id="last_line">
+ <a href="https://github.com/KnairdA/InputXSLT">Gemacht mit XSLT</a>
+ <ul>
+ <li><a href="{/meta/target/url}/seiten/kontakt">Kontakt</a></li>
+ <li class="last_item"><a href="{/meta/target/url}/rss">RSS</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/template/page.xsl b/template/page.xsl
new file mode 100644
index 0000000..a271e4a
--- /dev/null
+++ b/template/page.xsl
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:include href="master.xsl"/>
+<xsl:include href="[utility/date-time.xsl]"/>
+
+<xsl:template name="title-text">
+ <xsl:value-of select="/entry/h1"/> @ /home/adrian
+</xsl:template>
+
+<xsl:template match="data/entry">
+ <div class="last article">
+ <xsl:copy-of select="./*"/>
+ </div>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/formatter.xsl b/utility/formatter.xsl
new file mode 100644
index 0000000..49d8630
--- /dev/null
+++ b/utility/formatter.xsl
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:template name="formatter">
+ <xsl:param name="format"/>
+ <xsl:param name="source"/>
+
+ <xsl:copy-of select="InputXSLT:external-text-formatter(
+ $format,
+ $source
+ )/self::output/*"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/generator.xsl b/utility/generator.xsl
new file mode 100644
index 0000000..ca6f0c3
--- /dev/null
+++ b/utility/generator.xsl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:template name="generator">
+ <xsl:param name="input"/>
+ <xsl:param name="transformation"/>
+ <xsl:param name="target"/>
+
+ <xsl:copy-of select="InputXSLT:generate(
+ $input,
+ string($transformation),
+ string($target)
+ )/self::generation"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/reader.xsl b/utility/reader.xsl
new file mode 100644
index 0000000..31d6fcc
--- /dev/null
+++ b/utility/reader.xsl
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:template name="reader">
+ <xsl:param name="path"/>
+
+ <xsl:copy-of select="InputXSLT:read-file($path)/self::file/*"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/transformer.xsl b/utility/transformer.xsl
new file mode 100644
index 0000000..6c85a4e
--- /dev/null
+++ b/utility/transformer.xsl
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:template name="transformer">
+ <xsl:param name="input"/>
+ <xsl:param name="transformation"/>
+
+ <xsl:copy-of select="InputXSLT:transform(
+ $input,
+ string($transformation)
+ )/self::transformation/*"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/writer.xsl b/utility/writer.xsl
new file mode 100644
index 0000000..42e9502
--- /dev/null
+++ b/utility/writer.xsl
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="xalan InputXSLT"
+>
+
+<xsl:template name="writer">
+ <xsl:param name="source"/>
+ <xsl:param name="target"/>
+
+ <xsl:copy-of select="InputXSLT:write-file(
+ $target,
+ $source
+ )"/>
+</xsl:template>
+
+</xsl:stylesheet>