]> Lady’s Gitweb - Vocab/blob - transforms/site/render.xslt
Initial commit; initial set of vocabs
[Vocab] / transforms / site / render.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 © 2024 Lady [@ Ladys Computer].
8
9 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
10 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
11 -->
12 <!DOCTYPE transform [
13 <!ENTITY en '<attribute xmlns="http://www.w3.org/1999/XSL/Transform" name="lang"><text>en</text></attribute><attribute xmlns="http://www.w3.org/1999/XSL/Transform" name="xml:lang"><text>en</text></attribute>'>
14 ]>
15 <transform
16 xmlns="http://www.w3.org/1999/XSL/Transform"
17 xmlns:Vocab="urn:fdc:vocab.ladys.computer:20240731:ns"
18 xmlns:Vocabvocab="urn:fdc:vocab.ladys.computer:20240731:vocab:"
19 xmlns:html="http://www.w3.org/1999/xhtml"
20 xmlns:owl="http://www.w3.org/2002/07/owl#"
21 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
22 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
23 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
24 exclude-result-prefixes="Vocab Vocabvocab"
25 version="1.0"
26 >
27 <书社:id>urn:fdc:vocab.ladys.computer:20240731:transforms:site:render.xslt</书社:id>
28 <template name="Vocab:more-info">
29 <element name="html:span">
30 &en;
31 <element name="html:span">
32 <attribute name="aria-hidden">
33 <text>true</text>
34 </attribute>
35 <attribute name="style">
36 <text>text-decoration:none</text>
37 </attribute>
38 <attribute name="title">
39 <text>click to show rationale</text>
40 </attribute>
41 <text>?⃝</text>
42 </element>
43 <element name="html:span">
44 <attribute name="style">
45 <text>clip:rect(1px,1px,1px,1px);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute</text>
46 </attribute>
47 <text>rationale</text>
48 </element>
49 </element>
50 </template>
51 <template match="rdfs:Datatype" mode="Vocab:render-class">
52 <param name="root" select="/"/>
53 <param name="use-parens" select="false()"/>
54 <choose>
55 <when test="@rdf:about">
56 <apply-templates select="@rdf:about" mode="Vocab:render-class">
57 <with-param name="root" select="$root"/>
58 </apply-templates>
59 </when>
60 <when test="owl:oneOf">
61 <text>{</text>
62 <!-- owl:oneOf is not really supported; lists of literals are difficult. -->
63 <apply-templates select="owl:oneOf[1]" mode="Vocab:render-value">
64 <with-param name="root" select="$root"/>
65 </apply-templates>
66 <text>}</text>
67 </when>
68 <when test="owl:complementOf">
69 <if test="$use-parens">
70 <text>(</text>
71 </if>
72 <text>not </text>
73 <apply-templates select="(owl:complimentOf/@rdf:resource|owl:complimentOf/*)[1]" mode="Vocab:render-class">
74 <with-param name="root" select="$root"/>
75 <with-param name="use-parens" select="true()"/>
76 </apply-templates>
77 <if test="$use-parens">
78 <text>)</text>
79 </if>
80 </when>
81 <when test="owl:intersectionOf">
82 <if test="$use-parens">
83 <text>(</text>
84 </if>
85 <for-each select="owl:intersectionOf/*">
86 <apply-templates select="." mode="Vocab:render-class">
87 <with-param name="root" select="$root"/>
88 <with-param name="use-parens" select="true()"/>
89 </apply-templates>
90 <if test="position()&lt;last()">
91 <text> and </text>
92 </if>
93 </for-each>
94 <if test="$use-parens">
95 <text>)</text>
96 </if>
97 </when>
98 <when test="owl:unionOf">
99 <if test="$use-parens">
100 <text>(</text>
101 </if>
102 <for-each select="owl:unionOf/*">
103 <apply-templates select="." mode="Vocab:render-class">
104 <with-param name="root" select="$root"/>
105 <with-param name="use-parens" select="true()"/>
106 </apply-templates>
107 <if test="position()&lt;last()">
108 <text> or </text>
109 </if>
110 </for-each>
111 <if test="$use-parens">
112 <text>)</text>
113 </if>
114 </when>
115 <when test="owl:withRestrictions">
116 <apply-templates select="(owl:onDatatype/@rdf:resource|owl:onDatatype/*)[1]" mode="Vocab:render-class">
117 <with-param name="root" select="$root"/>
118 <with-param name="use-parens" select="true()"/>
119 </apply-templates>
120 <text>[</text>
121 <for-each select="owl:withRestrictions/*/*">
122 <variable name="restriction-namespace" select="namespace-uri()"/>
123 <variable name="restriction-local-name" select="local-name()"/>
124 <for-each select="$root">
125 <call-template name="Vocab:link-to">
126 <with-param name="resource">
127 <value-of select="$restriction-namespace"/>
128 <value-of select="$restriction-local-name"/>
129 </with-param>
130 <with-param name="kind" select="'property'"/>
131 </call-template>
132 </for-each>
133 <text> </text>
134 <apply-templates select="." mode="Vocab:render-value">
135 <with-param name="root" select="$root"/>
136 </apply-templates>
137 <if test="position()&lt;last()">
138 <text>, </text>
139 </if>
140 </for-each>
141 <text>]</text>
142 </when>
143 <otherwise>
144 <text>??</text>
145 </otherwise>
146 </choose>
147 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
148 <with-param name="root" select="$root"/>
149 </apply-templates>
150 </template>
151 <template match="owl:Class" mode="Vocab:render-class">
152 <param name="root" select="/"/>
153 <param name="resource-context"/>
154 <param name="use-parens" select="false()"/>
155 <choose>
156 <when test="@rdf:about">
157 <apply-templates select="@rdf:about" mode="Vocab:render-class">
158 <with-param name="root" select="$root"/>
159 <with-param name="resource-context" select="$resource-context"/>
160 </apply-templates>
161 </when>
162 <when test="owl:oneOf">
163 <text>{</text>
164 <for-each select="owl:oneOf/*">
165 <apply-templates select="." name="Vocab:render-individual">
166 <with-param name="root" select="$root"/>
167 <with-param name="resource-context" select="$resource-context"/>
168 </apply-templates>
169 <if test="position()&lt;last()">
170 <text>, </text>
171 </if>
172 </for-each>
173 <text>}</text>
174 </when>
175 <when test="owl:complementOf">
176 <if test="$use-parens">
177 <text>(</text>
178 </if>
179 <text>not </text>
180 <apply-templates select="(owl:complementOf/@rdf:resource|owl:complementOf/*)[1]" mode="Vocab:render-class">
181 <with-param name="root" select="$root"/>
182 <with-param name="resource-context" select="$resource-context"/>
183 <with-param name="use-parens" select="true()"/>
184 </apply-templates>
185 <if test="$use-parens">
186 <text>)</text>
187 </if>
188 </when>
189 <when test="owl:intersectionOf">
190 <if test="$use-parens">
191 <text>(</text>
192 </if>
193 <for-each select="owl:intersectionOf/*">
194 <apply-templates select="." mode="Vocab:render-class">
195 <with-param name="root" select="$root"/>
196 <with-param name="resource-context" select="$resource-context"/>
197 <with-param name="use-parens" select="true()"/>
198 </apply-templates>
199 <if test="position()&lt;last()">
200 <text> and </text>
201 </if>
202 </for-each>
203 <if test="$use-parens">
204 <text>)</text>
205 </if>
206 </when>
207 <when test="owl:unionOf">
208 <if test="$use-parens">
209 <text>(</text>
210 </if>
211 <for-each select="owl:unionOf/*">
212 <apply-templates select="." mode="Vocab:render-class">
213 <with-param name="root" select="$root"/>
214 <with-param name="resource-context" select="$resource-context"/>
215 <with-param name="use-parens" select="true()"/>
216 </apply-templates>
217 <if test="position()&lt;last()">
218 <text> or </text>
219 </if>
220 </for-each>
221 <if test="$use-parens">
222 <text>)</text>
223 </if>
224 </when>
225 <otherwise>
226 <text>??</text>
227 </otherwise>
228 </choose>
229 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
230 <with-param name="root" select="$root"/>
231 <with-param name="resource-context" select="$resource-context"/>
232 </apply-templates>
233 </template>
234 <template match="owl:Restriction" mode="Vocab:render-class">
235 <param name="root" select="/"/>
236 <param name="resource-context"/>
237 <param name="use-parens" select="false()"/>
238 <variable name="property" select="(owl:onProperty/@rdf:resource|owl:onProperty/*)[1]"/>
239 <variable name="is-on-datatype-property" select="$property/self::owl:DatatypeProperty or not($property/self::*) and //rdf:RDF//owl:DatatypeProperty[@rdf:about=string($property) or owl:sameAs/@rdf:resource=string($property)]"/>
240 <if test="$use-parens">
241 <text>(</text>
242 </if>
243 <apply-templates select="$property" mode="Vocab:render-property">
244 <with-param name="root" select="$root"/>
245 <with-param name="resource-context" select="$resource-context"/>
246 </apply-templates>
247 <choose>
248 <when test="owl:someValuesFrom">
249 <text> some </text>
250 <apply-templates select="(owl:someValuesFrom/@rdf:resource|owl:someValuesFrom/*)[1]" mode="Vocab:render-class">
251 <with-param name="root" select="$root"/>
252 <with-param name="resource-context" select="$resource-context"/>
253 <with-param name="use-parens" select="true()"/>
254 </apply-templates>
255 </when>
256 <when test="owl:allValuesFrom">
257 <text> only </text>
258 <apply-templates select="(owl:allValuesFrom/@rdf:resource|owl:allValuesFrom/*)[1]" mode="Vocab:render-class">
259 <with-param name="root" select="$root"/>
260 <with-param name="resource-context" select="$resource-context"/>
261 <with-param name="use-parens" select="true()"/>
262 </apply-templates>
263 </when>
264 <when test="owl:hasValue">
265 <text> value </text>
266 <choose>
267 <when test="$is-on-datatype-property">
268 <apply-templates select="owl:hasValue[1]" mode="Vocab:render-value">
269 <with-param name="root" select="$root"/>
270 <with-param name="resource-context" select="$resource-context"/>
271 </apply-templates>
272 </when>
273 <otherwise>
274 <apply-templates select="owl:hasValue/@rdf:resource" mode="Vocab:render-individual">
275 <with-param name="root" select="$root"/>
276 <with-param name="resource-context" select="$resource-context"/>
277 </apply-templates>
278 </otherwise>
279 </choose>
280 </when>
281 <when test="owl:hasSelf">
282 <text> Self</text>
283 </when>
284 <when test="owl:minCardinality|owl:minQualifiedCardinality">
285 <text> min </text>
286 <value-of select="owl:minCardinality|owl:minQualifiedCardinality"/>
287 </when>
288 <when test="owl:maxCardinality|owl:maxQualifiedCardinality">
289 <text> max </text>
290 <value-of select="owl:maxCardinality|owl:maxQualifiedCardinality"/>
291 </when>
292 <when test="owl:cardinality|owl:qualifiedCardinality">
293 <text> exactly </text>
294 <value-of select="owl:cardinality|owl:qualifiedCardinality"/>
295 </when>
296 <otherwise>
297 <text>??</text>
298 </otherwise>
299 </choose>
300 <if test="owl:onClass">
301 <text> </text>
302 <apply-templates select="(owl:onClass/@rdf:resource|owl:onClass/*)[1]" mode="Vocab:render-class">
303 <with-param name="root" select="$root"/>
304 <with-param name="resource-context" select="$resource-context"/>
305 <with-param name="use-parens" select="true()"/>
306 </apply-templates>
307 </if>
308 <if test="owl:onDataRange">
309 <text> </text>
310 <apply-templates select="(owl:onDataRange/@rdf:resource|owl:onDataRange/*)[1]" mode="Vocab:render-class">
311 <with-param name="root" select="$root"/>
312 <with-param name="resource-context" select="$resource-context"/>
313 <with-param name="use-parens" select="true()"/>
314 </apply-templates>
315 </if>
316 <if test="$use-parens">
317 <text>)</text>
318 </if>
319 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
320 <with-param name="root" select="$root"/>
321 <with-param name="resource-context" select="$resource-context"/>
322 </apply-templates>
323 </template>
324 <template match="rdf:Description" mode="Vocab:render-class">
325 <param name="root" select="/"/>
326 <param name="resource-context"/>
327 <choose>
328 <when test="@rdf:about">
329 <apply-templates select="@rdf:about" mode="Vocab:render-class">
330 <with-param name="root" select="$root"/>
331 <with-param name="resource-context" select="$resource-context"/>
332 </apply-templates>
333 </when>
334 <otherwise>
335 <text>??</text>
336 </otherwise>
337 </choose>
338 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
339 <with-param name="root" select="$root"/>
340 <with-param name="resource-context" select="$resource-context"/>
341 </apply-templates>
342 </template>
343 <template match="Vocabvocab:inferred-from" mode="Vocab:render-class">
344 <param name="root" select="/"/>
345 <param name="resource-context"/>
346 <if test="string($resource-context)='' or string(@rdf:resource)!=$resource-context">
347 <text> </text>
348 <element name="html:details">
349 <attribute name="class">
350 <text>inference</text>
351 </attribute>
352 <element name="html:summary">
353 <call-template name="Vocab:more-info"/>
354 </element>
355 <element name="html:div">
356 <element name="html:span">
357 &en;
358 <text>implied by</text>
359 </element>
360 <text> </text>
361 <apply-templates select="@rdf:resource" mode="Vocab:render-class">
362 <with-param name="root" select="$root"/>
363 </apply-templates>
364 </element>
365 </element>
366 </if>
367 </template>
368 <template match="@rdf:about|@rdf:resource" mode="Vocab:render-class">
369 <param name="root" select="/"/>
370 <variable name="resource" select="string()"/>
371 <for-each select="$root">
372 <call-template name="Vocab:link-to">
373 <with-param name="resource" select="$resource"/>
374 <with-param name="kind" select="'class'"/>
375 </call-template>
376 </for-each>
377 </template>
378 <template match="*" mode="Vocab:render-class">
379 <text>??</text>
380 </template>
381 <template match="rdf:Description" mode="Vocab:render-individual">
382 <param name="root" select="/"/>
383 <param name="resource-context"/>
384 <choose>
385 <when test="@rdf:about">
386 <apply-templates select="@rdf:about" mode="Vocab:render-individual">
387 <with-param name="root" select="$root"/>
388 <with-param name="resource-context" select="$resource-context"/>
389 </apply-templates>
390 </when>
391 <otherwise>
392 <text>??</text>
393 </otherwise>
394 </choose>
395 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-individual">
396 <with-param name="root" select="$root"/>
397 <with-param name="resource-context" select="$resource-context"/>
398 </apply-templates>
399 </template>
400 <template match="Vocabvocab:inferred-from" mode="Vocab:render-individual">
401 <param name="root" select="/"/>
402 <param name="resource-context"/>
403 <if test="string($resource-context)='' or string(@rdf:resource)!=$resource-context">
404 <text> </text>
405 <element name="html:details">
406 <attribute name="class">
407 <text>inference</text>
408 </attribute>
409 <element name="html:summary">
410 <call-template name="Vocab:more-info"/>
411 </element>
412 <element name="html:div">
413 <element name="html:span">
414 &en;
415 <text>implied by</text>
416 </element>
417 <text> </text>
418 <apply-templates select="@rdf:resource" mode="Vocab:render-individual">
419 <with-param name="root" select="$root"/>
420 </apply-templates>
421 </element>
422 </element>
423 </if>
424 </template>
425 <template match="@rdf:about|@rdf:resource" mode="Vocab:render-individual">
426 <param name="root" select="/"/>
427 <variable name="resource" select="string()"/>
428 <for-each select="$root">
429 <call-template name="Vocab:link-to">
430 <with-param name="resource" select="$resource"/>
431 <with-param name="kind" select="'individual'"/>
432 </call-template>
433 </for-each>
434 </template>
435 <template match="*" mode="Vocab:render-individual">
436 <text>??</text>
437 </template>
438 <template match="owl:AnnotationProperty|owl:DatatypeProperty|rdf:Description" mode="Vocab:render-property">
439 <param name="root" select="/"/>
440 <param name="resource-context"/>
441 <choose>
442 <when test="@rdf:about">
443 <apply-templates select="@rdf:about" mode="Vocab:render-property">
444 <with-param name="root" select="$root"/>
445 <with-param name="resource-context" select="$resource-context"/>
446 </apply-templates>
447 </when>
448 <otherwise>
449 <text>??</text>
450 </otherwise>
451 </choose>
452 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-property">
453 <with-param name="root" select="$root"/>
454 <with-param name="resource-context" select="$resource-context"/>
455 </apply-templates>
456 </template>
457 <template match="owl:ObjectProperty" mode="Vocab:render-property">
458 <param name="root" select="/"/>
459 <param name="resource-context"/>
460 <choose>
461 <when test="@rdf:about">
462 <apply-templates select="@rdf:about" mode="Vocab:render-property">
463 <with-param name="root" select="$root"/>
464 <with-param name="resource-context" select="$resource-context"/>
465 </apply-templates>
466 </when>
467 <when test="owl:inverseOf">
468 <text>inverse </text>
469 <apply-templates select="(owl:inverseOf/@rdf:resource|owl:inverseOf/*)[1]" mode="Vocab:render-property">
470 <with-param name="root" select="$root"/>
471 <with-param name="resource-context" select="$resource-context"/>
472 </apply-templates>
473 </when>
474 <otherwise>
475 <text>??</text>
476 </otherwise>
477 </choose>
478 <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-property">
479 <with-param name="root" select="$root"/>
480 <with-param name="resource-context" select="$resource-context"/>
481 </apply-templates>
482 </template>
483 <template match="Vocabvocab:inferred-from" mode="Vocab:render-property">
484 <param name="root" select="/"/>
485 <param name="resource-context"/>
486 <if test="string($resource-context)='' or string(@rdf:resource)!=$resource-context">
487 <text> </text>
488 <element name="html:details">
489 <attribute name="class">
490 <text>inference</text>
491 </attribute>
492 <element name="html:summary">
493 <call-template name="Vocab:more-info"/>
494 </element>
495 <element name="html:div">
496 <element name="html:span">
497 &en;
498 <text>implied by</text>
499 </element>
500 <text> </text>
501 <apply-templates select="@rdf:resource" mode="Vocab:render-property">
502 <with-param name="root" select="$root"/>
503 </apply-templates>
504 </element>
505 </element>
506 </if>
507 </template>
508 <template match="@rdf:about|@rdf:resource" mode="Vocab:render-property">
509 <param name="root" select="/"/>
510 <variable name="resource" select="string()"/>
511 <for-each select="$root">
512 <call-template name="Vocab:link-to">
513 <with-param name="resource" select="$resource"/>
514 <with-param name="kind" select="'property'"/>
515 </call-template>
516 </for-each>
517 </template>
518 <template match="*" mode="Vocab:render-property">
519 <text>??</text>
520 </template>
521 <template match="*" mode="Vocab:render-value">
522 <param name="root" select="/"/>
523 <element name="html:code">
524 <text>&quot;</text>
525 <element name="html:span">
526 <if test="string(@xml:lang)!=''">
527 <attribute name="lang">
528 <value-of select="@xml:lang"/>
529 </attribute>
530 <attribute name="xml:lang">
531 <value-of select="@xml:lang"/>
532 </attribute>
533 </if>
534 <value-of select="."/>
535 </element>
536 <text>&quot;</text>
537 <choose>
538 <when test="string(@xml:lang)!=''">
539 <text>@</text>
540 <value-of select="@xml:lang"/>
541 </when>
542 <when test="@rdf:datatype and string(@rdf:datatype)!='http://www.w3.org/2001/XMLSchema#string'">
543 <text>^^</text>
544 <for-each select="/">
545 <call-template name="Vocab:link-to">
546 <with-param name="resource" select="@rdf:datatype"/>
547 <with-param name="kind" select="'class'"/>
548 </call-template>
549 </for-each>
550 </when>
551 </choose>
552 </element>
553 </template>
554 </transform>
This page took 0.201074 seconds and 5 git commands to generate.