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 xmlns="http://www.w3.org/1999/XSL/Transform"
14 xmlns:Vocab="urn:fdc:vocab.ladys.computer:20240731:ns"
15 xmlns:Vocabvocab="urn:fdc:vocab.ladys.computer:20240731:vocab:"
16 xmlns:html="http://www.w3.org/1999/xhtml"
17 xmlns:owl="http://www.w3.org/2002/07/owl#"
18 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
19 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
20 xmlns:shacl="http://www.w3.org/ns/shacl#"
21 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
22 exclude-result-prefixes="Vocab Vocabvocab"
25 <书社:id>urn:fdc:vocab.ladys.computer:20240731:transforms:rdf.xslt</书社:id>
26 <key name="Vocab:name" match="owl:AnnotationProperty|owl:Class|owl:DatatypeProperty|owl:NamedIndividual|owl:ObjectProperty|rdfs:Datatype" use="@rdf:about|owl:sameAs/@rdf:resource"/>
27 <template match="/rdf:RDF" priority="2">
29 <attribute name="xml:base">
30 <call-template name="Vocab:base"/>
32 <apply-templates select="@*[not(local-name()='base' and namespace-uri()='http://www.w3.org/XML/1998/namespace')]|node()"/>
35 <template match="/rdf:RDF/*[@rdf:about and Vocabvocab:superClassOf]" priority="2">
37 <apply-templates select="@*|node()[not(self::Vocabvocab:superClassOf)]"/>
39 <for-each select="Vocabvocab:superClassOf/*[1]">
41 <apply-templates select="@*|node()"/>
42 <element name="rdfs:subClassOf">
43 <attribute name="rdf:resource">
44 <value-of select="../../@rdf:about"/>
50 <template match="/rdf:RDF//@rdf:resource" priority="2">
51 <variable name="base-iri">
52 <call-template name="Vocab:base"/>
54 <attribute name="rdf:resource">
56 <when test="starts-with(., 'about:vocab?') and contains(., '=')">
57 <variable name="query" select="substring-after(., 'about:vocab?')"/>
58 <variable name="qterm" select="substring-before($query, '=')"/>
59 <variable name="subdir">
61 <when test="$qterm='class'">
64 <when test="$qterm='property'">
65 <text>properties/</text>
68 <text>individuals/</text>
72 <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')]]"/>
75 <value-of select="$match/@rdf:about"/>
78 <value-of select="."/>
83 <value-of select="."/>
88 <template match="/rdf:RDF//html:a" priority="1">
89 <variable name="base-prefix">
90 <call-template name="Vocab:prefix">
91 <with-param name="unprefixed">
92 <call-template name="Vocab:base"/>
96 <variable name="kind" select="@data-kind"/>
97 <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]"/>
99 <apply-templates select="@*[not(contains(' data-curie data-kind ', local-name()) and namespace-uri()='')]"/>
101 <when test="$linked-resource">
102 <variable name="curie">
103 <call-template name="Vocab:prefix">
104 <with-param name="unprefixed" select="string(@href)"/>
107 <variable name="localid">
109 <when test="starts-with($curie, $base-prefix)">
110 <value-of select="substring-after($curie, $base-prefix)"/>
113 <value-of select="$curie"/>
117 <attribute name="data-curie">
118 <value-of select="$curie"/>
120 <attribute name="data-kind">
122 <when test="@data-kind">
123 <value-of select="@data-kind"/>
125 <when test="$linked-resource[self::owl:Class or self::owl:Datatype]">
128 <when test="$linked-resource[self::owl:AnnotationProperty or self::owl:ObjectProperty or self::owl:DatatypeProperty]">
129 <text>property</text>
132 <text>individual</text>
137 <when test="html:code[not(preceding-sibling::node() or following-sibling::node())]">
138 <for-each select="$linked-resource">
139 <variable name="wrappername">
141 <when test="substring($localid, 1, 1)='(' and substring($localid, string-length($localid), 1)=')'">
149 <attribute name="title">
150 <value-of select="rdfs:label[1]"/>
152 <value-of select="$curie"/>
155 <element name="html:{$wrappername}">
156 <attribute name="lang">
157 <value-of select="rdfs:label[1]/@xml:lang"/>
159 <attribute name="xml:lang">
160 <value-of select="rdfs:label[1]/@xml:lang"/>
162 <value-of select="rdfs:label[1]"/>
177 <template match="/rdf:RDF//html:a/@href[starts-with(., '#footnote-')]">
178 <attribute name="href">
179 <text>#footnote-</text>
180 <value-of select="generate-id(ancestor::rdfs:comment//@id[string()=substring-after(current(), '#')])"/>
183 <template match="/rdf:RDF//html:*/@id[starts-with(., 'footnote-')]" priority="1">
184 <attribute name="id">
185 <text>footnote-</text>
186 <value-of select="generate-id()"/>