/
planetsToXHTMLNamed.xsl
77 lines (75 loc) · 1.99 KB
/
planetsToXHTMLNamed.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
71
72
73
74
75
76
77
<?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">
<xsl:call-template name="css" />
</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 name="css">
body {font-family: Verdana, Arial, sans-serif; font-size: 12px;}
</xsl:template>
<xsl:template match="planet">
<h2>
<xsl:value-of select="@name"/>
</h2>
<xsl:value-of select="description/text()"/>
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="positionFromSun">
<li>
<strong>Position from sun: </strong>
<xsl:value-of select="text()"/>
</li>
</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>