/
planets5.xsl
70 lines (70 loc) · 1.88 KB
/
planets5.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()"/>
<xsl:template match="neighbours">
<html>
<head>
<title>A simple HTML page</title>
<style type="text/css">
body { font-family: Verdana, Arial, sans-serif; font-size: 12px;}
</style>
</head>
<body>
<p>
<a href="http://www.nasa.gov/">Visit NASA!</a> | <a href="http://www.nineplanets.org/">Tour the solar system</a>
</p>
<h1>Our neighbours</h1>
<xsl:apply-templates/>
<hr/>
Copyright Planetary Fun 2006.
</body>
</html>
</xsl:template>
<xsl:template match="planet">
<img width="100" height="100">
<xsl:attribute name="src"><xsl:value-of select="@name"/>.jpg
</xsl:attribute>
</img>
<h2>
<xsl:value-of select="@name"/>
</h2>
<xsl:value-of select="description/text()"/>
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="diameter">
<li>
<strong>Diameter: </strong>
<xsl:value-of select="text()"/>
</li>
</xsl:template>
<xsl:template match="moons">
<li>
<strong>Moons: </strong>
<xsl:value-of select="text()"/>
</li>
</xsl:template>
<xsl:template match="meanTemp">
<li>
<strong>Mean temperature: </strong>
<xsl:value-of select="text()"/>
</li>
</xsl:template>
<xsl:template match="oneDay">
<li>
<strong>Length of one day: </strong>
<xsl:value-of select="text()"/>
</li>
</xsl:template>
<xsl:template match="oneYear">
<li>
<strong>Length of one year: </strong>
<xsl:value-of select="text()"/>
</li>
</xsl:template>
</xsl:stylesheet>