-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTrees.xsl
52 lines (47 loc) · 1.81 KB
/
Trees.xsl
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
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date">
<xsl:output encoding="UTF-8"/>
<xsl:key name="children" match="Person" use="@ChildOf" />
<xsl:key name="marriage" match="Person" use="@MarriedTo" />
<xsl:template match="/Tree">
<html>
<head><link rel="stylesheet" href="../TreeStyle.css" type="text/css"/></head><body>
<div class="tree" id="tree">
<ul>
<xsl:apply-templates select="Person[@ChildOf='0']"/>
</ul>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="Person">
<li>
<xsl:variable name="marriage" select="key('marriage', @ID)" />
<a href="#">
<xsl:choose>
<xsl:when test="@Gender = 'male'">
<xsl:attribute name="class">male</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">female</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@Death">✝</xsl:if>
<xsl:value-of select="@FirstName" /> <xsl:value-of select="@LastName" /><xsl:if test="$marriage"> ⚭ <xsl:if test="$marriage/@Death">✝</xsl:if><xsl:value-of select="$marriage/@FirstName"/> <xsl:value-of select="$marriage/@LastName"/></xsl:if>
</a>
<xsl:variable name="children" select="key('children', @ID)" />
<xsl:if test="$children">
<ul>
<xsl:apply-templates select="$children" />
</ul>
</xsl:if>
<!--- Wenn die Person Kind des angeheirateten Partnes ist-->
<xsl:variable name="children1" select="key('children', $marriage/@ID)" />
<xsl:if test="$children1">
<ul>
<xsl:apply-templates select="$children1" />
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>