diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-03-06 23:54:49 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-03-06 23:54:49 +0100 |
commit | ca1a6aa7df6703c10d1cd97afedd9c6838ba425b (patch) | |
tree | ca8a7fbd6fd4d43268a095ead32f7b4fecd38b72 /xsl/webpage.xsl | |
parent | e2f172624be2c0cc96461bdd9418e23e798a93b2 (diff) |
First commit of the ousia based website architecture
Diffstat (limited to 'xsl/webpage.xsl')
-rw-r--r-- | xsl/webpage.xsl | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/xsl/webpage.xsl b/xsl/webpage.xsl new file mode 100644 index 0000000..c6310e2 --- /dev/null +++ b/xsl/webpage.xsl @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:webpage="webpage" + exclude-result-prefixes="webpage"> + <xsl:output method="html" encoding="utf-8" indent="yes" /> + <xsl:strip-space elements="*"/> + <xsl:preserve-space elements="webpage:text"/> + + <xsl:template match="/"> + <xsl:apply-templates select="/document/webpage:webpage"/> + </xsl:template> + + <xsl:template match="/document/webpage:webpage"> + <xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text> + <html> + <head> + <meta charset="utf-8"/> + <link rel="stylesheet" type="text/css" href="style/style.css"/> + <title><xsl:apply-templates select="title/webpage:text"/></title> + </head> + <body lang="en"> + <header> + <section> + <h1>Ousía Framework</h1> + <nav> + <ul> + <li><a href="#">About</a></li> + <li><a href="#">Documentation</a></li> + <li><a href="#">Download</a></li> + </ul> + </nav> + </section> + </header> + <main> + <xsl:apply-templates select="webpage:*"/> + </main> + <footer> + <section> + <nav> + <ul> + <li><h3>Learn</h3> + <ul> + <li><a href="index.html">About</a></li> + <!--<li><a href="#">Tutorial</a></li> + <li><a href="#">FAQ</a></li> + <li><a href="#">Examples</a></li>--> + </ul> + </li> + <li><h3>Get Ousía</h3> + <ul> + <li><a href="download.html">Download</a></li> + <!--<li><a href="#">Repository</a></li>--> + </ul> + </li> + <!--<li><h3>Develop</h3> + <ul> + <li><a href="#">Documentation</a></li> + <li><a href="#">Browse source</a></li> + <li><a href="#">Bug tracker</a></li> + </ul> + </li>--> + <li><h3>Legal</h3> + <ul> + <li><a href="impressum.html">Impressum</a></li> + <li><a href="license.html">License</a></li> + </ul> + </li> + </ul> + </nav> + </section> + <section id="copyright"> + <p>Ousía – Extensible Semantic Markup Framework (c) 2015 Andreas Stöckel, Benjamin Paaßen</p> + <p>Unless noted otherwise the content of this website (including, but not limited to text, images, markup and stylesheets) is licensed under the <a href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>. The uncompiled source code of the website is available at TODO. + </p> + <p> + This website was made using <a href="http://git-scm.com/">git</a>, <a href="http://lesscss.org/">Less</a>, <a href="http://ousia-framework.org/">Ousía</a> and <a href="http://xmlsoft.org/libxslt/">xsltproc</a>. + </p> + </section> + </footer> + <script type="text/javascript" src="script/ousia.js"/> + </body> + </html> + </xsl:template> + + <!-- Transform masthead and section into a section --> + <xsl:template match="webpage:masthead|webpage:section"> + <section> + <xsl:if test="self::webpage:masthead"> + <xsl:attribute name="class">masthead</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="title"/> + <xsl:apply-templates select="subtitle"/> + <xsl:apply-templates select="webpage:*"/> + + <!-- Gather all footnotes --> + <xsl:if test="descendant::webpage:footnote"> + <ol class="footnotes"> + <xsl:apply-templates select="descendant::webpage:footnote" mode="footnote"/> + </ol> + </xsl:if> + </section> + </xsl:template> + + <!-- Subsections --> + <xsl:template match="webpage:pitch|webpage:nav|webpage:subsection"> + <div> + <xsl:variable name="seqNo"><xsl:number level="any" count="webpage:pitch|webpage:nav|webpage:subsection" format="1"/></xsl:variable> + <xsl:variable name="class">subsection<xsl:if test="self::webpage:pitch"> pitch</xsl:if><xsl:if test="self::webpage:nav"> nav</xsl:if> <xsl:if test="$seqNo = 1"> first</xsl:if></xsl:variable> + <xsl:attribute name="class"> + <xsl:value-of select="$class"/> + </xsl:attribute> + <xsl:apply-templates select="webpage:*"/> + </div> + </xsl:template> + + <!-- Titles and subtitles --> + <xsl:template match="title"> + <xsl:if test="webpage:text"> + <h1><xsl:apply-templates select="webpage:text"/></h1> + </xsl:if> + </xsl:template> + <xsl:template match="subtitle"> + <xsl:if test="webpage:text"> + <h2><xsl:apply-templates select="webpage:text"/></h2> + </xsl:if> + </xsl:template> + + <!-- Paragraphs --> + <xsl:template match="webpage:paragraph"> + <p> + <xsl:apply-templates select="child::*"/> + </p> + </xsl:template> + + <!-- Buttons --> + <xsl:template match="webpage:button"> + <a class="button"> + <xsl:copy-of select="@*" /> + <xsl:apply-templates select="webpage:text"/> + </a> + </xsl:template> + + <!-- IPA --> + <xsl:template match="webpage:ipa"> + <xsl:value-of select="webpage:text"/> + <span class="ipa"> [<xsl:value-of select="pronunciation"/>] </span> + </xsl:template> + + <!-- Footnotes --> + <!-- Adapted from: http://www.microhowto.info/howto/create_a_list_of_numbered_footnotes_using_xslt.html --> + <xsl:template match="webpage:footnote"> + <a> + <xsl:attribute name="name">footnoteref<xsl:number level="any" count="webpage:footnote" format="1"/></xsl:attribute> + <xsl:attribute name="href">#footnote<xsl:number level="any" count="webpage:footnote" format="1"/></xsl:attribute> + <sup><xsl:number level="any" count="webpage:footnote" format="[1]"/></sup> + </a> + </xsl:template> + <xsl:template match="webpage:footnote" mode="footnote"> + <li> + <a> + <xsl:attribute name="name">footnote<xsl:number level="any" count="webpage:footnote" format="1"/></xsl:attribute> + <xsl:attribute name="href">#footnoteref<xsl:number level="any" count="webpage:footnote" format="1"/></xsl:attribute> + <xsl:number level="any" count="webpage:footnote" format="[1]"/> + </a> + <xsl:text> </xsl:text> + <xsl:apply-templates select="webpage:*"/> + </li> + </xsl:template> +</xsl:stylesheet> + |