File: page_sioc_output.xsl

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (129 lines) | stat: -rw-r--r-- 5,831 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?xml version='1.0'?>
<!--
 -  
 -  $Id: page_sioc_output.xsl,v 1.6 2007/05/09 10:49:23 source Exp $
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2006 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"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:sioc="http://rdfs.org/sioc/ns#"
  version='1.0'>
<xsl:output method="xml" indent="yes"/>
<!--<xsl:include href="page_common.xsl"/>
<xsl:include href="page_html_common.xsl"/>-->
<xsl:template match="tutorial">
<?vsp
      declare _path,_domain varchar;
      _domain := cfg_item_value (virtuoso_ini_path(), 'URIQA', 'DefaultHost');
      if (_domain is null)
      {
        http_request_status (sprintf ('HTTP/1.1 500 %s', 'SIOC RDF output cannot be constructed without URIQA DefaultHost set. Please contact the site administrator and report the problem.'));
        return;
      }
		  http_header ('Content-Type: text/xml\r\n');
      _path := 'http://' || ltrim(_domain,'/') || '/tutorial/';
?>
<rdf:RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
		  <xsl:attribute name="rdf" namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
		  <xsl:attribute name="dc" namespace="http://purl.org/dc/elements/1.1/"/>
  <xsl:attribute name="dcterms" namespace="http://purl.org/dc/terms/"/>
  <!--<xsl:attribute name="content" namespace="http://purl.org/rss/1.0/modules/content/"/>-->
                  <xsl:attribute name="foaf" namespace="http://xmlns.com/foaf/0.1/"/>
		  <xsl:attribute name="sioc" namespace="http://rdfs.org/sioc/ns#"/>
<xsl:text disable-output-escaping="yes"><![CDATA[
<sioc:Space rdf:about="<?V _path ?>">]]></xsl:text>
      	<sioc:name>OpenLink Virtuoso Features Demonstrations and Tutorials</sioc:name>
      	<sioc:description>OpenLink Virtuoso Features Demonstrations and Tutorials</sioc:description>
        <xsl:for-each select="//subsection[not(@ref)]">
      	  <xsl:text disable-output-escaping="yes"><![CDATA[
    <sioc:space_of rdf:resource="<?V _path ?>]]></xsl:text>
 <xsl:value-of select="@wwwpath"/>
 <xsl:text disable-output-escaping="yes"><![CDATA["/>]]></xsl:text>
        </xsl:for-each>
      <xsl:text disable-output-escaping="yes"><![CDATA[
</sioc:Space>]]></xsl:text>
<xsl:apply-templates select="//subsection[not(@ref)]"/>
<xsl:apply-templates select="//example"/>
</rdf:RDF>
</xsl:template>

<xsl:template match="subsection">
<xsl:text disable-output-escaping="yes"><![CDATA[
<sioc:Container rdf:about="<?V _path ?>]]></xsl:text>
 <xsl:value-of select="@wwwpath"/>
 <xsl:text disable-output-escaping="yes"><![CDATA[">]]></xsl:text>
    	<sioc:description>
    	  <xsl:value-of select="parent::section/@Title" disable-output-escaping="yes"/>
	      <xsl:text> - </xsl:text>
	      <xsl:value-of select="@Title" disable-output-escaping="yes"/>
    	</sioc:description>
    	<rdf:type>Tutorial</rdf:type>
      	<xsl:text disable-output-escaping="yes"><![CDATA[
  <sioc:has_space rdf:resource="<?V _path ?>"/>]]></xsl:text>
        <xsl:for-each select=".//example">
      	  <xsl:text disable-output-escaping="yes"><![CDATA[
    <sioc:container_of rdf:resource="<?V _path ?>]]></xsl:text>
    <xsl:value-of select="@wwwpath"/>
 <xsl:text disable-output-escaping="yes"><![CDATA["/>]]></xsl:text>
        </xsl:for-each>
      <xsl:text disable-output-escaping="yes"><![CDATA[
</sioc:Container>]]></xsl:text>
</xsl:template>
	
<xsl:template match="example">
<xsl:text disable-output-escaping="yes"><![CDATA[
<foaf:Document rdf:about="<?V _path ?>]]></xsl:text>
 <xsl:value-of select="@wwwpath"/>
 <xsl:text disable-output-escaping="yes"><![CDATA[">]]></xsl:text>
      <xsl:text disable-output-escaping="yes"><![CDATA[
  <sioc:has_container rdf:resource="<?V _path ?>]]></xsl:text>
 <xsl:value-of select="ancestor::subsection/@wwwpath"/>
 <xsl:text disable-output-escaping="yes"><![CDATA["/>]]></xsl:text>
	    <dc:title><xsl:value-of select="refentry/refnamediv/refname"/></dc:title>
  <dcterms:created_at><xsl:value-of select="@date"/></dcterms:created_at>
	    <sioc:description><xsl:value-of select="refentry/refnamediv/refpurpose"/></sioc:description>
      <sioc:content>
        <xsl:for-each select="refentry/refsect1">
          <xsl:apply-templates mode="strip"/>
        </xsl:for-each>
      </sioc:content>
      <content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
        <xsl:for-each select="refentry/refsect1">
          <xsl:apply-templates />
        </xsl:for-each>
        <xsl:text disable-output-escaping="yes">]]></xsl:text>
      </content:encoded>
      <xsl:text disable-output-escaping="yes"><![CDATA[
</foaf:Document>]]></xsl:text>

</xsl:template>

<xsl:template match="*" priority="20" mode="strip">
    <xsl:apply-templates mode="strip" />
</xsl:template>

</xsl:stylesheet>