diff options
author | defanor <defanor@uberspace.net> | 2018-05-01 06:10:19 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2018-05-01 06:10:19 +0300 |
commit | 56c57f94738efab8b0bf83dc68480931a2ceee00 (patch) | |
tree | 30663a142eedd52670a68e26885cff6348a45d3f /tools/xml-to-html.xsl | |
parent | e0b97e0e2168c4d2b9cf60b16e81591f912c2f4a (diff) |
Focus on source XML manipulation, introduce indexes
Instead of XHTML or Atom, so resulting files get generated out of
custom XML structures now.
This was needed to get indexes that won't depend on Atom (and to avoid
the duplication).
Now indexes can be included with something like the following:
<notes xmlns="" number="5"
src="../build/notes-by-modification-date.xml" />
Diffstat (limited to 'tools/xml-to-html.xsl')
-rw-r--r-- | tools/xml-to-html.xsl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl index 97e8431..1b92318 100644 --- a/tools/xml-to-html.xsl +++ b/tools/xml-to-html.xsl @@ -77,7 +77,7 @@ href="/xhtml-rdfa-light.css" /> <meta name="robots" content="noarchive" /> </head> - <xsl:copy-of select="xhtml:body" /> + <xsl:apply-templates mode="body" select="xhtml:body" /> </html> </xsl:template> @@ -92,4 +92,31 @@ <xsl:copy-of select="." /> </xsl:template> + <xsl:template mode="body" match="notes"> + <xsl:variable name="notes" select="document(@src)" /> + <xsl:variable name="number" select="@number" /> + <dl> + <xsl:apply-templates mode="note-index" + select="$notes/notes/note[$number=0 or position()<=$number]" /> + </dl> + </xsl:template> + + <xsl:template mode="note-index" match="note"> + <dt> + <a href="{@src}"> + <xsl:value-of select="document/@title" /> + </a> + </dt> + <dd> + <xsl:value-of select="document/@description" /> + </dd> + </xsl:template> + + <xsl:template mode="body" match="node()" priority="0"> + <xsl:copy> + <xsl:copy-of select="@*" /> + <xsl:apply-templates mode="body" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> |