about summary refs log tree commit diff homepage
path: root/page.xslt
blob: b8dc5208fb82e6c717286bf27124cb947faf6cbd (plain) (blame)
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/xhtml">
  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
  <xsl:template match="/page">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
      <head>
        <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
        <meta name="color-scheme" content="dark light"/>
        <link rel="alternate" type="application/atom+xml" href="/atom.xml"/>
        <link rel="icon" href="/favicon.svg"/>
        <link rel="stylesheet" href="/style.css"/>
        <title>pix by cnx</title>
      </head>
      <body>
        <nav>
          <xsl:if test="@prev != ''"><a href="/{@prev}/">PREV</a></xsl:if>
          <h1>PAGE <xsl:value-of select="@curr"/></h1>
          <xsl:if test="@next != ''"><a href="/{@next}/">NEXT</a></xsl:if>
        </nav>
        <xsl:variable name="base">
          <xsl:text>/</xsl:text>
          <xsl:value-of select="@curr"/>
          <xsl:text>/</xsl:text>
        </xsl:variable>

        <xsl:for-each select="post">
          <xsl:variable name="id">
            <xsl:value-of select="translate(@title, ' ', '-')"/>
          </xsl:variable>
          <article id="{$id}" lang="{@lang}">
            <h2><a href="#{$id}">
              <xsl:value-of select="@title"/>
            </a></h2>
            <xsl:for-each select="picture">
              <a href="{$base}{@filename}.jpg">
                <img alt="{@desc}" title="{@desc}"
                     src="{$base}{@filename}.small.jpg"/>
              </a><br/>
            </xsl:for-each>
          </article>
        </xsl:for-each>

        <footer>
          <a title="CC BY-SA"
             href="https://creativecommons.org/licenses/by-sa/4.0">
            <xsl:copy-of select="document('cc.svg')/*"/>
            <xsl:copy-of select="document('by.svg')/*"/>
            <xsl:copy-of select="document('sa.svg')/*"/>
          </a>
          <xsl:text> </xsl:text>
          <xsl:value-of select="@year"/>
          <xsl:text> </xsl:text>
          <a href="https://cnx.gdn">Nguyễn Gia Phong</a>
        </footer>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>