File: xq_s_4.xsl

package info (click to toggle)
virtuoso-opensource 7.2.12%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 299,780 kB
  • sloc: ansic: 655,047; sql: 508,209; xml: 269,573; java: 84,064; javascript: 79,847; cpp: 37,662; sh: 32,429; cs: 25,702; php: 12,690; yacc: 11,661; lex: 7,933; makefile: 7,309; jsp: 4,523; awk: 1,719; perl: 1,013; ruby: 1,003; python: 326
file content (109 lines) | stat: -rw-r--r-- 3,866 bytes parent folder | download | duplicates (2)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?xml version='1.0'?>
<!--
 -  
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2024 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:demo="http://www.openlinksw.com/demo/">
    <xsl:output method="xhtml"  indent="yes" encoding="utf-8" omit-xml-declaration="yes" media-type="text/html" />

    <xsl:param name="ord" />
    <xsl:param name="type" />
    <xsl:template match="opml">
	<html>
	    <body>
		<H1><xsl:value-of select="head/title"/></H1>
		<a href="?opml"><img src="opml2.png" border="0" /></a>
		<a href="?foaf"><img src="foaf.gif" border="0" /></a>
		<table border="1">
		    <tr>
			<th><a href="?ord=name">Person</a></th>
			<th><a href="?ord=title">Site</a></th>
			<th><a href="?ord=url">Feed</a></th>
		    </tr>
			<xsl:choose>
			    <xsl:when test="$ord = 'name'">
				<xsl:call-template name="name_sort"/>
			    </xsl:when>
			    <xsl:when test="$ord = 'title'">
				<xsl:call-template name="title_sort"/>
			    </xsl:when>
			    <xsl:when test="$ord = 'url'">
				<xsl:call-template name="url_sort"/>
			    </xsl:when>
			    <xsl:otherwise>
				<xsl:call-template name="default"/>
			    </xsl:otherwise>
			</xsl:choose>
		</table>
	    </body>
	</html>
    </xsl:template>

    <xsl:template name="name_sort">
	<xsl:for-each select="body/outline">
	    <xsl:sort select="@text"/>
	    <xsl:call-template name="row"/>
	</xsl:for-each>
    </xsl:template>
    <xsl:template name="title_sort">
	<xsl:for-each select="body/outline">
	    <xsl:sort select="@title"/>
	    <xsl:call-template name="row"/>
	</xsl:for-each>
    </xsl:template>
    <xsl:template name="url_sort">
	<xsl:for-each select="body/outline">
	    <xsl:sort select="@xmlUrl"/>
	    <xsl:call-template name="row"/>
	</xsl:for-each>
    </xsl:template>
    <xsl:template name="default">
	<xsl:for-each select="body/outline">
	    <xsl:call-template name="row"/>
	</xsl:for-each>
    </xsl:template>

    <xsl:template name="row">
	<tr>
	    <td>
		<xsl:variable name="ip" select="demo:getIP (@htmlUrl, @xmlUrl)"/>
		<xsl:if test="$ip != ''">
		    <xsl:variable name="alt" select="demo:getCountry (@htmlUrl, @xmlUrl)"/>
		    <img src="http://api.hostip.info/flag.php?ip={$ip}" alt="{$alt}" title="{$alt}" height="12" hspace="3"/>
  	        </xsl:if>
		<xsl:value-of select="@text"/>
	    </td>
	    <td><a href="{@htmlUrl}"><xsl:value-of select="@title"/></a></td>
	    <td nowrap="1">
		<xsl:if test="string (@xmlUrl) != ''">
		  <a href="atom.vsp?URL={urlify (@xmlUrl)}"><img src="atom.gif" border="0" hspace="3" />Atom</a>&#160;
		  <a href="sioc.vsp?URL={urlify (@xmlUrl)}"><img src="rdf.gif" alt="SIOC" border="0" hspace="3" />SIOC (RDF/XML)</a>&#160;
		  <a href="sioc.vsp?URL={urlify (@xmlUrl)}&amp;fmt=ttl"><img src="rdf.gif" alt="SIOC" border="0" hspace="3" />SIOC (N3/Turtle)</a>&#160;
	        </xsl:if>
		<a href="{@xmlUrl}"><xsl:if test="string (@xmlUrl) != ''"><img src="mxml.gif" border="0" hspace="3"/></xsl:if><xsl:value-of select="@xmlUrl"/></a></td>
	</tr>
    </xsl:template>

</xsl:stylesheet>