From 6265f7f4be3a54a8a27330918c59ef16da458124 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 20 Jul 2014 20:02:55 +0200 Subject: Split page datasource entry into title and content * 'h1' node is used as title and any other node as content * modified result page transformation accordingly --- source/02_data/pages.xsl | 11 ++++++++++- source/03_result/page.xsl | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/02_data/pages.xsl b/source/02_data/pages.xsl index 85ea8ca..f2360c1 100644 --- a/source/02_data/pages.xsl +++ b/source/02_data/pages.xsl @@ -23,11 +23,20 @@ </xsl:variable> <xsl:template match="files/pages/file[./extension = '.md']"> - <entry handle="{./name}"> + <xsl:variable name="content"> <xsl:call-template name="formatter"> <xsl:with-param name="format">/usr/bin/markdown</xsl:with-param> <xsl:with-param name="source" select="InputXSLT:read-file(./full)/text()"/> </xsl:call-template> + </xsl:variable> + + <entry handle="{./name}"> + <title> + <xsl:value-of select="xalan:nodeset($content)/h1"/> + </title> + <content> + <xsl:copy-of select="xalan:nodeset($content)/*[name() != 'h1']"/> + </content> </entry> </xsl:template> diff --git a/source/03_result/page.xsl b/source/03_result/page.xsl index f6113f3..e3839a7 100644 --- a/source/03_result/page.xsl +++ b/source/03_result/page.xsl @@ -23,12 +23,13 @@ </xsl:variable> <xsl:template name="title-text"> - <xsl:value-of select="/datasource/page/entry/h1"/> + <xsl:value-of select="/datasource/page/entry/title"/> </xsl:template> <xsl:template match="page/entry"> <div class="last article"> - <xsl:copy-of select="./*"/> + <h3><xsl:value-of select="./title"/></h3> + <xsl:copy-of select="./content/*"/> </div> </xsl:template> -- cgit v1.2.3