3 SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
7 © 2024–2025 Lady [@ Ladys Computer].
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/>.
13 <!ENTITY xhtml 'http://www.w3.org/1999/xhtml'>
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:"
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:shacl="http://www.w3.org/ns/shacl#"
24 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
25 exclude-result-prefixes="Vocab Vocabvocab"
28 <书社:id>urn:fdc:vocab.ladys.computer:20240731:transforms:rdf.xslt</书社:id>
29 <key name="Vocab:name" match="owl:AnnotationProperty|owl:Class|owl:DatatypeProperty|owl:NamedIndividual|owl:ObjectProperty|rdfs:Datatype" use="@rdf:about|owl:sameAs/@rdf:resource"/>
30 <template match="/rdf:RDF" priority="2">
32 <attribute name="xml:base">
33 <call-template name="Vocab:base"/>
35 <apply-templates select="@*[not(local-name()='base' and namespace-uri()='http://www.w3.org/XML/1998/namespace')]|node()"/>
38 <template match="/rdf:RDF/*[@rdf:about and Vocabvocab:superClassOf]" priority="2">
40 <apply-templates select="@*|node()[not(self::Vocabvocab:superClassOf)]"/>
42 <for-each select="Vocabvocab:superClassOf/*[1]">
44 <apply-templates select="@*|node()"/>
45 <element name="rdfs:subClassOf">
46 <attribute name="rdf:resource">
47 <value-of select="../../@rdf:about"/>
53 <template match="/rdf:RDF//@rdf:resource" priority="2">
54 <variable name="base-iri">
55 <call-template name="Vocab:base"/>
57 <attribute name="rdf:resource">
59 <when test="starts-with(., 'about:vocab?') and contains(., '=')">
60 <variable name="query" select="substring-after(., 'about:vocab?')"/>
61 <variable name="qterm" select="substring-before($query, '=')"/>
62 <variable name="subdir">
64 <when test="$qterm='class'">
67 <when test="$qterm='property'">
68 <text>properties/</text>
71 <text>individuals/</text>
75 <variable name="match" select="//*[rdfs:isDefinedBy[starts-with(@rdf:resource, $base-iri) and substring-after(@rdf:resource, $base-iri)=concat($subdir, substring-after($query, '='), '.xhtml')]]"/>
78 <value-of select="$match/@rdf:about"/>
81 <value-of select="."/>
86 <value-of select="."/>
91 <template match="/rdf:RDF//html:a" priority="1">
92 <variable name="base-prefix">
93 <call-template name="Vocab:prefix">
94 <with-param name="unprefixed">
95 <call-template name="Vocab:base"/>
99 <variable name="kind" select="@data-kind"/>
100 <variable name="linked-resource" select="key('Vocab:name', @href)[not($kind) or $kind='class' and (self::owl:Class or self::owl:Datatype) or $kind='property' and (self::owl:AnnotationProperty or self::owl:ObjectProperty or self::owl:DatatypeProperty) or $kind='individual' and self::owl:NamedIndividual][1]"/>
102 <apply-templates select="@*[not(contains(' data-curie data-kind ', local-name()) and namespace-uri()='')]"/>
104 <when test="$linked-resource">
105 <variable name="curie">
106 <call-template name="Vocab:prefix">
107 <with-param name="unprefixed" select="string(@href)"/>
110 <variable name="localid">
112 <when test="starts-with($curie, $base-prefix)">
113 <value-of select="substring-after($curie, $base-prefix)"/>
116 <value-of select="$curie"/>
120 <attribute name="data-curie">
121 <value-of select="$curie"/>
123 <attribute name="data-kind">
125 <when test="@data-kind">
126 <value-of select="@data-kind"/>
128 <when test="$linked-resource[self::owl:Class or self::owl:Datatype]">
131 <when test="$linked-resource[self::owl:AnnotationProperty or self::owl:ObjectProperty or self::owl:DatatypeProperty]">
132 <text>property</text>
135 <text>individual</text>
140 <when test="html:code[not(preceding-sibling::node() or following-sibling::node())]">
141 <for-each select="$linked-resource">
142 <variable name="wrappername">
144 <when test="substring($localid, 1, 1)='(' and substring($localid, string-length($localid), 1)=')'">
152 <attribute name="title">
153 <value-of select="rdfs:label[1]"/>
155 <value-of select="$curie"/>
158 <element name="{$wrappername}" namespace="&xhtml;">
159 <attribute name="lang">
160 <value-of select="rdfs:label[1]/@xml:lang"/>
162 <attribute name="xml:lang">
163 <value-of select="rdfs:label[1]/@xml:lang"/>
165 <value-of select="rdfs:label[1]"/>
180 <template match="/rdf:RDF//html:a/@href[starts-with(., '#footnote-')]">
181 <attribute name="href">
182 <text>#footnote-</text>
183 <value-of select="generate-id(ancestor::rdfs:comment//@id[string()=substring-after(current(), '#')])"/>
186 <template match="/rdf:RDF//html:*/@id[starts-with(., 'footnote-')]" priority="1">
187 <attribute name="id">
188 <text>footnote-</text>
189 <value-of select="generate-id()"/>