aboutsummaryrefslogtreecommitdiff
path: root/source/02_augment/articles.xsl
blob: 771c0f8bcdf8d1098649bee38ab7c4ffa5dd0086 (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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

<xsl:include href="[utility/datasource.xsl]"/>

<xsl:variable name="meta">
	<datasource type="main"  mode="full" source="01_raw/blog_feed.xml" target="articles"/>
	<target     mode="plain" value="articles.xml"/>
</xsl:variable>

<xsl:template match="id" mode="article"/>

<xsl:template match="author" mode="article">
	<xsl:copy>
		<xsl:value-of select="name"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="updated" mode="article">
	<date>
		<xsl:value-of select="substring(., 0, 11)"/>
	</date>
</xsl:template>

<xsl:template match="link" mode="article">
	<link>
		<xsl:value-of select="@href"/>
	</link>
</xsl:template>

<xsl:template match="@href" mode="article">
	<xsl:choose>
		<xsl:when test="substring(., 0, 2) = '/'">
			<xsl:attribute name="href">
				<xsl:text>http://blog.kummerlaender.eu</xsl:text>
				<xsl:value-of select="."/>
			</xsl:attribute>
		</xsl:when>
		<xsl:otherwise>
			<xsl:attribute name="href">
				<xsl:value-of select="."/>
			</xsl:attribute>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="content[@type = 'xhtml']" mode="article">
	<content>
		<xsl:apply-templates select="div/p[1]/node()" mode="article"/>
	</content>
</xsl:template>

<xsl:template match="@* | node()" mode="article">
	<xsl:copy>
		<xsl:apply-templates select="@* | node()" mode="article"/>
	</xsl:copy>
</xsl:template>

<xsl:template match="articles">
	<xsl:apply-templates select="entry" mode="article"/>
</xsl:template>

</xsl:stylesheet>