aboutsummaryrefslogtreecommitdiff
path: root/templates/index.xsl
blob: ee60c72b2c336859168c1fa8eab37a9868675120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" encoding="UTF-8"
              doctype-system="about:legacy-compat"/>

  <xsl:variable name="site-name">
    <xsl:choose>
      <xsl:when test="/page/@site-name">
        <xsl:value-of select="/page/@site-name"/>
      </xsl:when>
      <xsl:otherwise>Pleasant SSO</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:template match="/page">
    <html xml:lang="en" lang="en">
      <head>
        <title>
          <xsl:if test="@title">
            <xsl:value-of select="@title"/>
            —
          </xsl:if>
          <xsl:value-of select="$site-name"/>
        </title>
        <meta name="viewport" content="width=device-width,initial-scale=1"/>
        <link rel="stylesheet" href="/static/style.css"/>
      </head>
      <body>
        <xsl:call-template name="page-header"/>
        <main>
          <xsl:if test="@title">
            <h1><xsl:value-of select="@title"/></h1>
          </xsl:if>
          <xsl:apply-templates/>
        </main>
        <xsl:call-template name="page-footer"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="page-header">
    <header>
      <site-name><xsl:value-of select="$site-name"/></site-name>
    </header>
  </xsl:template>

  <xsl:template name="page-footer">
    <footer>
      <a><xsl:attribute name="href">
        <xsl:value-of select="/page/@source"/>
      </xsl:attribute>
      Source code</a>
    </footer>
  </xsl:template>

  <xsl:template match="content">
    <xsl:copy-of select="*"/>
  </xsl:template>

  <xsl:template match="error">
    <error-message>
      <box-label>Error</box-label>
      <xsl:copy-of select="."/>
    </error-message>
  </xsl:template>

</xsl:stylesheet>