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
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/TR/RDF/"
xmlns:d="http://purl.org/dc/elements/1.0/"
xmlns:dmoz="http://dmoz.org/rdf">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template name="links">
<xsl:param name="ref"/>
<xsl:apply-templates select="//dmoz:ExternalPage[@about=$ref]"/>
</xsl:template>
<xsl:template match="dmoz:ExternalPage">
<h4><xsl:value-of select="d:Title"/></h4>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="@about"/></xsl:attribute>
<xsl:value-of select="d:Description"/>
</xsl:element>
</xsl:template>
<xsl:template match="dmoz:Topic">
<xsl:variable name="ref">
<xsl:text>#</xsl:text>
<xsl:value-of select="@rdf:id"/>
</xsl:variable>
<div>
<h1>
<xsl:attribute name="id"><xsl:value-of select="@rdf:id"/></xsl:attribute>
<xsl:value-of select="@rdf:id"/>
</h1>
<xsl:for-each select="dmoz:link"><p>
<xsl:call-template name="links">
<xsl:with-param name="ref"><xsl:value-of select="@rdf:resource"/></xsl:with-param>
</xsl:call-template>
</p></xsl:for-each>
</div>
</xsl:template>
<xsl:template name="rdf">
<html>
<head>
<title>RDF Schema Listing</title>
<link href="default.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<xsl:apply-templates select="//dmoz:Topic">
<xsl:sort select="count(dmoz:link)"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="rdf"/>
</xsl:template>
</xsl:stylesheet>
|