/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk
1 by Suren A. Chilingaryan
Initial import
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" 
3
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
4
    xmlns:rdf="http://www.w3.org/TR/RDF/"
5
    xmlns:d="http://purl.org/dc/elements/1.0/"
6
    xmlns:dmoz="http://dmoz.org/rdf">
7
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
8
9
	
10
	<xsl:template name="links">
11
	    <xsl:param name="ref"/>
12
	    <xsl:apply-templates select="//dmoz:ExternalPage[@about=$ref]"/>
13
	</xsl:template>
14
15
	<xsl:template match="dmoz:ExternalPage">
16
    	    <h4><xsl:value-of select="d:Title"/></h4>
17
	    <xsl:element name="a">
18
		<xsl:attribute name="href"><xsl:value-of select="@about"/></xsl:attribute>
19
		<xsl:value-of select="d:Description"/>
20
	    </xsl:element>
21
    	</xsl:template>
22
23
	<xsl:template match="dmoz:Topic">
24
		<xsl:variable name="ref">
25
			<xsl:text>#</xsl:text>
26
			<xsl:value-of select="@rdf:id"/>
27
		</xsl:variable>
28
		<div>
29
			<h1>
30
				<xsl:attribute name="id"><xsl:value-of select="@rdf:id"/></xsl:attribute>
31
				<xsl:value-of select="@rdf:id"/>
32
			</h1>
33
			<xsl:for-each select="dmoz:link"><p>
34
			    <xsl:call-template name="links">
35
				<xsl:with-param name="ref"><xsl:value-of select="@rdf:resource"/></xsl:with-param>
36
			    </xsl:call-template>
37
			</p></xsl:for-each>
38
		</div>
39
    	</xsl:template>
40
41
			
42
	<xsl:template name="rdf">
43
		<html>
44
			<head>
45
				<title>RDF Schema Listing</title>
46
				<link href="default.css" rel="stylesheet" type="text/css"/>
47
			</head>
48
			<body>
49
			    <xsl:apply-templates select="//dmoz:Topic">
50
				<xsl:sort select="count(dmoz:link)"/>
51
			    </xsl:apply-templates>
52
			</body>
53
		</html>
54
	</xsl:template>
55
56
	<xsl:template match="/">
57
	    <xsl:call-template name="rdf"/>
58
	</xsl:template>
59
	
60
</xsl:stylesheet>