Debian Codegraph @

gavo/resources/web/xsl/oai.xsl

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- A stylesheet turning OAI-PMH responses into something viewable
4 in a web browser. This basically lets people explore our publishing
5 registry without being blinded by XML.
6
7 This stylesheet is made available under CC-0 by the GAVO project,
8 http://www.g-vo.org.
9 See http://creativecommons.org/publicdomain/zero/1.0/ for details.
10 -->
11
12 <xsl:stylesheet
13 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
14 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15 xmlns:ri="http://www.ivoa.net/xml/RegistryInterface/v1.0"
16 xmlns:oai="http://www.openarchives.org/OAI/2.0/"
17 xmlns="http://www.w3.org/1999/xhtml"
18 version="1.0">
19
20 <xsl:include href="dachs-xsl-config.xsl"/>
21
22 <!-- ############################################## Global behaviour -->
23
24 <xsl:output method="xml"
25 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
26 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
27
28 <!-- Don't spill the content of unknown elements. -->
29 <xsl:template match="text()"/>
30
31 <xsl:template match="oai:OAI-PMH">
32 <html>
33 <head>
34 <title>OAI PMH</title>
35 <xsl:call-template name="localCompleteHead"/>
36 <style type="text/css"><![CDATA[
37 .nestbox {
38 padding: 1ex;
39 margin-top: 2ex;
40 border: 1px solid grey;
41 position: relative;
42 }
43 .boxtitle {
44 background-color: white;
45 position: absolute;
46 top: -3ex;
47 }
48 .deleted a {
49 text-decoration: line-through;
50 }
51 p.attrpair {
52 text-align: right;
53 margin: 0pt;
54 padding: 0pt;
55 font-size: 80%;
56 max-width: 2000pt;
57 }
58 span.value {
59 display: inline-block;
60 min-width: 11em;
61 }
62 ]]></style>
63 </head>
64 <body>
65 <h1>OAI PMH result of <xsl:value-of select="oai:responseDate"/>
66 </h1>
67 <xsl:apply-templates/>
68 <p><a href="/oai.xml?verb=ListIdentifiers&amp;metadataPrefix=ivo_vor">All identifiers defined here</a></p>
69 <xsl:call-template name="localMakeFoot"/>
70 </body>
71 </html>
72 </xsl:template>
73
74 <xsl:template match="oai:request">
75 <p class="reqinfo">
76 Request verb was <xsl:value-of select="@verb"/>
77 </p>
78 </xsl:template>
79
80 <xsl:template match="oai:error">
81 <div class="errors"><p>Error code <xsl:value-of select="@code"/>:
82 <xsl:value-of select="."/></p>
83 </div>
84 </xsl:template>
85
86 <xsl:template match="oai:ListIdentifiers">
87 <ul class="listIdentifiers">
88 <xsl:apply-templates/>
89 </ul>
90 </xsl:template>
91
92 <xsl:template match="oai:header">
93 <li>
94 <xsl:attribute name="class">oairec
95 <xsl:value-of select="@status"/>
96 </xsl:attribute>
97 <xsl:apply-templates/>
98 </li>
99 </xsl:template>
100
101 <xsl:template match="oai:identifier">
102 <xsl:element name="a">
103 <xsl:attribute name="href">/oai.xml?verb=GetRecord&amp;metadataPrefix=ivo_vor&amp;identifier=<xsl:value-of select="."/>
104 </xsl:attribute>
105 <xsl:value-of select="."/>
106 </xsl:element>
107 </xsl:template>
108
109 <xsl:template match="oai:metadata">
110 <xsl:apply-templates mode="dumpall"/>
111 </xsl:template>
112
113 <xsl:template match="*" mode="dumpall">
114 <div class="nestbox">
115 <p class="boxtitle"><xsl:value-of select="name(.)"/></p>
116 <xsl:apply-templates select="@*"/>
117 <xsl:apply-templates mode="dumpall"/>
118 </div>
119 </xsl:template>
120
121 <xsl:template match="@*" priority="1">
122 <xsl:choose>
123 <xsl:when test="name()='ivo-id'">
124 <p class="attrpair"><span class="key">&#8594;</span>
125 <span class="value"><a>
126 <xsl:attribute name="href"
127 >/oai.xml?verb=GetRecord&amp;metadataPrefix=ivo_vor&amp;identifier=<xsl:value-of select="."/>
128 </xsl:attribute><xsl:value-of select="."/></a></span></p>
129 </xsl:when>
130 <xsl:otherwise>
131 <p class="attrpair">
132 <span class="key"><xsl:value-of select="name()"/></span>:
133 <span class="value"><xsl:value-of select="."/></span>
134 </p>
135 </xsl:otherwise>
136 </xsl:choose>
137 </xsl:template>
138
139 <xsl:template match="/ri:Resource">
140 <!-- naked ri:Resource at the root: this is from metarender -->
141 <html>
142 <head>
143 <title>Resource Record for
144 <xsl:value-of select="identifier"/></title>
145 <xsl:call-template name="localCompleteHead"/>
146 <style type="text/css"><![CDATA[
147 .nestbox {
148 padding: 1ex;
149 margin-top: 2ex;
150 border: 1px solid grey;
151 position: relative;
152 }
153 .boxtitle {
154 background-color: white;
155 position: absolute;
156 top: -3ex;
157 }
158 .deleted a {
159 text-decoration: line-through;
160 }
161 p.attrpair {
162 text-align: right;
163 margin: 0pt;
164 padding: 0pt;
165 font-size: 80%;
166 max-width: 2000pt;
167 }
168 span.value {
169 display: inline-block;
170 min-width: 11em;
171 }
172 ]]></style>
173 </head>
174 <body>
175 <h1>Resource Record for <xsl:value-of select="identifier"/>
176 </h1>
177 <ul>
178 <li>Status: <xsl:value-of select="@status"/></li>
179 <li>Type: <xsl:value-of select="@xsi:type"/></li>
180 <li>Created: <xsl:value-of select="@created"/></li>
181 <li>Updated: <xsl:value-of select="@updated"/></li>
182 </ul>
183 <xsl:apply-templates mode="dumpall"/>
184 <xsl:call-template name="localMakeFoot"/>
185 </body>
186 </html>
187 </xsl:template>
188 </xsl:stylesheet>
189
190
191 <!-- vim:et:sw=4:sta
192 -->