summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2018-04-26 23:37:31 +0300
committerdefanor <defanor@uberspace.net>2018-04-26 23:37:31 +0300
commitbd95151b556ebb16cd9e4987386d0448d2ff38b1 (patch)
tree006d20ab5686a443feeba92348043943639aefcf
parentfa37b9bd3fd2cd8ea7de0e3b6d2a6f1ab228b8ba (diff)
Get rid of <meta> in the source XML
Metadata is stored directly in document attributes now, no need for a special element here.
-rw-r--r--tools/skeleton.xml18
-rw-r--r--tools/xml-to-html.xsl103
2 files changed, 57 insertions, 64 deletions
diff --git a/tools/skeleton.xml b/tools/skeleton.xml
index a65f179..6cd8db6 100644
--- a/tools/skeleton.xml
+++ b/tools/skeleton.xml
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document>
- <meta title=""
- description=""
- keywords=""
- created=""
- published=""
- modified=""
- primaryTopic="">
- <topic iri="" />
- </meta>
+<document title=""
+ description=""
+ keywords=""
+ created=""
+ published=""
+ modified=""
+ primaryTopic="">
+ <topic iri="" />
<body xmlns="http://www.w3.org/1999/xhtml">
</body>
diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl
index 1b1358d..65441c2 100644
--- a/tools/xml-to-html.xsl
+++ b/tools/xml-to-html.xsl
@@ -23,68 +23,63 @@
home: https://defanor.uberspace.net/"
typeof="dc:Text schema:Article foaf:Document">
<head>
- <xsl:apply-templates select="meta" />
+ <!-- Only title is required -->
+ <title property="dc:title schema:name foaf:name">
+ <xsl:value-of select="@title" />
+ </title>
+ <xsl:if test="@description">
+ <meta name="description"
+ property="dc:description schema:description"
+ content="{@description}" />
+ </xsl:if>
+ <xsl:if test="@keywords">
+ <meta name="keywords"
+ property="schema:keywords"
+ content="{@keywords}" />
+ </xsl:if>
+ <xsl:if test="@created">
+ <meta property="dc:created schema:dateCreated"
+ datatype="schema:Date"
+ content="{@created}" />
+ </xsl:if>
+ <xsl:if test="@published">
+ <meta property="dc:issued schema:datePublished"
+ datatype="schema:Date"
+ content="{@published}" />
+ </xsl:if>
+ <xsl:if test="@modified">
+ <meta property="dc:modified schema:dateModified"
+ datatype="schema:Date"
+ content="{@modified}" />
+ </xsl:if>
+ <xsl:if test="@primaryTopic">
+ <link property="dc:subject schema:about foaf:primaryTopic"
+ href="{@primaryTopic}" />
+ </xsl:if>
+
+ <xsl:apply-templates select="topic" />
+
+ <!-- The rest is fixed metadata -->
+ <link property="dc:creator schema:creator foaf:maker"
+ href="/foaf.rdf#me" />
+ <link property="dc:isPartOf schema:isPartOf"
+ href="https://defanor.uberspace.net/" />
+ <link rel="stylesheet" title="Dark, blueish"
+ href="/xhtml-rdfa-dark.css" />
+ <link rel="alternate stylesheet" title="No colourisation"
+ href="/xhtml-rdfa.css" />
+ <link rel="alternate stylesheet" title="Light, beige"
+ href="/xhtml-rdfa-light.css" />
+ <meta name="robots" content="noarchive" />
</head>
<xsl:copy-of select="xhtml:body" />
</html>
</xsl:template>
- <!-- Metadata -->
- <xsl:template match="meta">
- <!-- Only title is required -->
- <title property="dc:title schema:name foaf:name">
- <xsl:value-of select="@title" />
- </title>
- <xsl:if test="@description">
- <meta name="description"
- property="dc:description schema:description"
- content="{@description}" />
- </xsl:if>
- <xsl:if test="@keywords">
- <meta name="keywords"
- property="schema:keywords"
- content="{@keywords}" />
- </xsl:if>
- <xsl:if test="@created">
- <meta property="dc:created schema:dateCreated"
- datatype="schema:Date"
- content="{@created}" />
- </xsl:if>
- <xsl:if test="@published">
- <meta property="dc:issued schema:datePublished"
- datatype="schema:Date"
- content="{@published}" />
- </xsl:if>
- <xsl:if test="@modified">
- <meta property="dc:modified schema:dateModified"
- datatype="schema:Date"
- content="{@modified}" />
- </xsl:if>
- <xsl:if test="@primaryTopic">
- <link property="dc:subject schema:about foaf:primaryTopic"
- href="{@primaryTopic}" />
- </xsl:if>
-
- <xsl:apply-templates select="topic" />
-
- <!-- The rest is fixed metadata -->
- <link property="dc:creator schema:creator foaf:maker"
- href="/foaf.rdf#me" />
- <link property="dc:isPartOf schema:isPartOf"
- href="https://defanor.uberspace.net/" />
- <link rel="stylesheet" title="Dark, blueish"
- href="/xhtml-rdfa-dark.css" />
- <link rel="alternate stylesheet" title="No colourisation"
- href="/xhtml-rdfa.css" />
- <link rel="alternate stylesheet" title="Light, beige"
- href="/xhtml-rdfa-light.css" />
- <meta name="robots" content="noarchive" />
- </xsl:template>
-
<!-- Additional topics -->
<xsl:template match="topic">
<link property="dc:subject schema:about foaf:topic"
href="{@iri}" />
</xsl:template>
-
+
</xsl:stylesheet>