]> Lady’s Gitweb - Vocab/blobdiff - transforms/render.xslt
Update ⛩📰 书社 to 0.13.3; “simplify” build
[Vocab] / transforms / render.xslt
diff --git a/transforms/render.xslt b/transforms/render.xslt
new file mode 100644 (file)
index 0000000..ae4663f
--- /dev/null
@@ -0,0 +1,554 @@
+<?xml version="1.0"?>
+<!--
+SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
+SPDX-License-Identifier: MPL-2.0
+-->
+<!--
+© 2024–2025 Lady [@ Ladys Computer].
+
+This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
+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/>.
+-->
+<!DOCTYPE transform [
+       <!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>'>
+]>
+<transform
+       xmlns="http://www.w3.org/1999/XSL/Transform"
+       xmlns:Vocab="urn:fdc:vocab.ladys.computer:20240731:ns"
+       xmlns:Vocabvocab="urn:fdc:vocab.ladys.computer:20240731:vocab:"
+       xmlns:html="http://www.w3.org/1999/xhtml"
+       xmlns:owl="http://www.w3.org/2002/07/owl#"
+       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+       xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+       xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
+       exclude-result-prefixes="Vocab Vocabvocab"
+       version="1.0"
+>
+       <书社:id>urn:fdc:vocab.ladys.computer:20240731:transforms:render.xslt</书社:id>
+       <template name="Vocab:more-info">
+               <element name="html:span">
+                       &en;
+                       <element name="html:span">
+                               <attribute name="aria-hidden">
+                                       <text>true</text>
+                               </attribute>
+                               <attribute name="style">
+                                       <text>text-decoration:none</text>
+                               </attribute>
+                               <attribute name="title">
+                                       <text>click to show rationale</text>
+                               </attribute>
+                               <text>?⃝</text>
+                       </element>
+                       <element name="html:span">
+                               <attribute name="style">
+                                       <text>clip:rect(1px,1px,1px,1px);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;padding:0;position:absolute</text>
+                               </attribute>
+                               <text>rationale</text>
+                       </element>
+               </element>
+       </template>
+       <template match="rdfs:Datatype" mode="Vocab:render-class">
+               <param name="root" select="/"/>
+               <param name="use-parens" select="false()"/>
+               <choose>
+                       <when test="@rdf:about">
+                               <apply-templates select="@rdf:about" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                               </apply-templates>
+                       </when>
+                       <when test="owl:oneOf">
+                               <text>{</text>
+                               <!-- owl:oneOf is not really supported; lists of literals are difficult. -->
+                               <apply-templates select="owl:oneOf[1]" mode="Vocab:render-value">
+                                       <with-param name="root" select="$root"/>
+                               </apply-templates>
+                               <text>}</text>
+                       </when>
+                       <when test="owl:datatypeComplementOf">
+                               <if test="$use-parens">
+                                       <text>(</text>
+                               </if>
+                               <text>not </text>
+                               <apply-templates select="(owl:datatypeComplementOf/@rdf:resource|owl:datatypeComplementOf/*)[1]" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="use-parens" select="true()"/>
+                               </apply-templates>
+                               <if test="$use-parens">
+                                       <text>)</text>
+                               </if>
+                       </when>
+                       <when test="owl:intersectionOf">
+                               <if test="$use-parens">
+                                       <text>(</text>
+                               </if>
+                               <for-each select="owl:intersectionOf/*">
+                                       <apply-templates select="." mode="Vocab:render-class">
+                                               <with-param name="root" select="$root"/>
+                                               <with-param name="use-parens" select="true()"/>
+                                       </apply-templates>
+                                       <if test="position()&lt;last()">
+                                               <text> and </text>
+                                       </if>
+                               </for-each>
+                               <if test="$use-parens">
+                                       <text>)</text>
+                               </if>
+                       </when>
+                       <when test="owl:unionOf">
+                               <if test="$use-parens">
+                                       <text>(</text>
+                               </if>
+                               <for-each select="owl:unionOf/*">
+                                       <apply-templates select="." mode="Vocab:render-class">
+                                               <with-param name="root" select="$root"/>
+                                               <with-param name="use-parens" select="true()"/>
+                                       </apply-templates>
+                                       <if test="position()&lt;last()">
+                                               <text> or </text>
+                                       </if>
+                               </for-each>
+                               <if test="$use-parens">
+                                       <text>)</text>
+                               </if>
+                       </when>
+                       <when test="owl:withRestrictions">
+                               <apply-templates select="(owl:onDatatype/@rdf:resource|owl:onDatatype/*)[1]" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="use-parens" select="true()"/>
+                               </apply-templates>
+                               <text>[</text>
+                               <for-each select="owl:withRestrictions/*/*">
+                                       <variable name="restriction-namespace" select="namespace-uri()"/>
+                                       <variable name="restriction-local-name" select="local-name()"/>
+                                       <for-each select="$root">
+                                               <call-template name="Vocab:link-to">
+                                                       <with-param name="resource">
+                                                               <value-of select="$restriction-namespace"/>
+                                                               <value-of select="$restriction-local-name"/>
+                                                       </with-param>
+                                                       <with-param name="kind" select="'property'"/>
+                                               </call-template>
+                                       </for-each>
+                                       <text> </text>
+                                       <apply-templates select="." mode="Vocab:render-value">
+                                               <with-param name="root" select="$root"/>
+                                       </apply-templates>
+                                       <if test="position()&lt;last()">
+                                               <text>, </text>
+                                       </if>
+                               </for-each>
+                               <text>]</text>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
+                       <with-param name="root" select="$root"/>
+               </apply-templates>
+       </template>
+       <template match="owl:Class" mode="Vocab:render-class">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <param name="use-parens" select="false()"/>
+               <choose>
+                       <when test="@rdf:about">
+                               <apply-templates select="@rdf:about" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                               </apply-templates>
+                       </when>
+                       <when test="owl:oneOf">
+                               <text>{</text>
+                               <for-each select="owl:oneOf/*">
+                                       <apply-templates select="." name="Vocab:render-individual">
+                                               <with-param name="root" select="$root"/>
+                                               <with-param name="resource-context" select="$resource-context"/>
+                                       </apply-templates>
+                                       <if test="position()&lt;last()">
+                                               <text>, </text>
+                                       </if>
+                               </for-each>
+                               <text>}</text>
+                       </when>
+                       <when test="owl:complementOf">
+                               <if test="$use-parens">
+                                       <text>(</text>
+                               </if>
+                               <text>not </text>
+                               <apply-templates select="(owl:complementOf/@rdf:resource|owl:complementOf/*)[1]" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                                       <with-param name="use-parens" select="true()"/>
+                               </apply-templates>
+                               <if test="$use-parens">
+                                       <text>)</text>
+                               </if>
+                       </when>
+                       <when test="owl:intersectionOf">
+                               <if test="$use-parens">
+                                       <text>(</text>
+                               </if>
+                               <for-each select="owl:intersectionOf/*">
+                                       <apply-templates select="." mode="Vocab:render-class">
+                                               <with-param name="root" select="$root"/>
+                                               <with-param name="resource-context" select="$resource-context"/>
+                                               <with-param name="use-parens" select="true()"/>
+                                       </apply-templates>
+                                       <if test="position()&lt;last()">
+                                               <text> and </text>
+                                       </if>
+                               </for-each>
+                               <if test="$use-parens">
+                                       <text>)</text>
+                               </if>
+                       </when>
+                       <when test="owl:unionOf">
+                               <if test="$use-parens">
+                                       <text>(</text>
+                               </if>
+                               <for-each select="owl:unionOf/*">
+                                       <apply-templates select="." mode="Vocab:render-class">
+                                               <with-param name="root" select="$root"/>
+                                               <with-param name="resource-context" select="$resource-context"/>
+                                               <with-param name="use-parens" select="true()"/>
+                                       </apply-templates>
+                                       <if test="position()&lt;last()">
+                                               <text> or </text>
+                                       </if>
+                               </for-each>
+                               <if test="$use-parens">
+                                       <text>)</text>
+                               </if>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+       </template>
+       <template match="owl:Restriction" mode="Vocab:render-class">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <param name="use-parens" select="false()"/>
+               <variable name="property" select="(owl:onProperty/@rdf:resource|owl:onProperty/*)[1]"/>
+               <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)]"/>
+               <if test="$use-parens">
+                       <text>(</text>
+               </if>
+               <apply-templates select="$property" mode="Vocab:render-property">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+               <choose>
+                       <when test="owl:someValuesFrom">
+                               <text> some </text>
+                               <apply-templates select="(owl:someValuesFrom/@rdf:resource|owl:someValuesFrom/*)[1]" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                                       <with-param name="use-parens" select="true()"/>
+                               </apply-templates>
+                       </when>
+                       <when test="owl:allValuesFrom">
+                               <text> only </text>
+                               <apply-templates select="(owl:allValuesFrom/@rdf:resource|owl:allValuesFrom/*)[1]" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                                       <with-param name="use-parens" select="true()"/>
+                               </apply-templates>
+                       </when>
+                       <when test="owl:hasValue">
+                               <text> value </text>
+                               <choose>
+                                       <when test="$is-on-datatype-property">
+                                               <apply-templates select="owl:hasValue[1]" mode="Vocab:render-value">
+                                                       <with-param name="root" select="$root"/>
+                                                       <with-param name="resource-context" select="$resource-context"/>
+                                               </apply-templates>
+                                       </when>
+                                       <otherwise>
+                                               <apply-templates select="owl:hasValue/@rdf:resource" mode="Vocab:render-individual">
+                                                       <with-param name="root" select="$root"/>
+                                                       <with-param name="resource-context" select="$resource-context"/>
+                                               </apply-templates>
+                                       </otherwise>
+                               </choose>
+                       </when>
+                       <when test="owl:hasSelf">
+                               <text> Self</text>
+                       </when>
+                       <when test="owl:minCardinality|owl:minQualifiedCardinality">
+                               <text> min </text>
+                               <value-of select="owl:minCardinality|owl:minQualifiedCardinality"/>
+                       </when>
+                       <when test="owl:maxCardinality|owl:maxQualifiedCardinality">
+                               <text> max </text>
+                               <value-of select="owl:maxCardinality|owl:maxQualifiedCardinality"/>
+                       </when>
+                       <when test="owl:cardinality|owl:qualifiedCardinality">
+                               <text> exactly </text>
+                               <value-of select="owl:cardinality|owl:qualifiedCardinality"/>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <if test="owl:onClass">
+                       <text> </text>
+                       <apply-templates select="(owl:onClass/@rdf:resource|owl:onClass/*)[1]" mode="Vocab:render-class">
+                               <with-param name="root" select="$root"/>
+                               <with-param name="resource-context" select="$resource-context"/>
+                               <with-param name="use-parens" select="true()"/>
+                       </apply-templates>
+               </if>
+               <if test="owl:onDataRange">
+                       <text> </text>
+                       <apply-templates select="(owl:onDataRange/@rdf:resource|owl:onDataRange/*)[1]" mode="Vocab:render-class">
+                               <with-param name="root" select="$root"/>
+                               <with-param name="resource-context" select="$resource-context"/>
+                               <with-param name="use-parens" select="true()"/>
+                       </apply-templates>
+               </if>
+               <if test="$use-parens">
+                       <text>)</text>
+               </if>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+       </template>
+       <template match="rdf:Description" mode="Vocab:render-class">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <choose>
+                       <when test="@rdf:about">
+                               <apply-templates select="@rdf:about" mode="Vocab:render-class">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                               </apply-templates>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-class">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+       </template>
+       <template match="Vocabvocab:inferred-from" mode="Vocab:render-class">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <if test="string($resource-context)='' or string(@rdf:resource)!=$resource-context">
+                       <text> </text>
+                       <element name="html:details">
+                               <attribute name="class">
+                                       <text>inference</text>
+                               </attribute>
+                               <element name="html:summary">
+                                       <call-template name="Vocab:more-info"/>
+                               </element>
+                               <element name="html:div">
+                                       <element name="html:span">
+                                               &en;
+                                               <text>implied by</text>
+                                       </element>
+                                       <text> </text>
+                                       <apply-templates select="@rdf:resource" mode="Vocab:render-class">
+                                               <with-param name="root" select="$root"/>
+                                       </apply-templates>
+                               </element>
+                       </element>
+               </if>
+       </template>
+       <template match="@rdf:about|@rdf:resource" mode="Vocab:render-class">
+               <param name="root" select="/"/>
+               <variable name="resource" select="string()"/>
+               <for-each select="$root">
+                       <call-template name="Vocab:link-to">
+                               <with-param name="resource" select="$resource"/>
+                               <with-param name="kind" select="'class'"/>
+                       </call-template>
+               </for-each>
+       </template>
+       <template match="*" mode="Vocab:render-class">
+               <text>??</text>
+       </template>
+       <template match="rdf:Description" mode="Vocab:render-individual">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <choose>
+                       <when test="@rdf:about">
+                               <apply-templates select="@rdf:about" mode="Vocab:render-individual">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                               </apply-templates>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-individual">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+       </template>
+       <template match="Vocabvocab:inferred-from" mode="Vocab:render-individual">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <if test="string($resource-context)='' or string(@rdf:resource)!=$resource-context">
+                       <text> </text>
+                       <element name="html:details">
+                               <attribute name="class">
+                                       <text>inference</text>
+                               </attribute>
+                               <element name="html:summary">
+                                       <call-template name="Vocab:more-info"/>
+                               </element>
+                               <element name="html:div">
+                                       <element name="html:span">
+                                               &en;
+                                               <text>implied by</text>
+                                       </element>
+                                       <text> </text>
+                                       <apply-templates select="@rdf:resource" mode="Vocab:render-individual">
+                                               <with-param name="root" select="$root"/>
+                                       </apply-templates>
+                               </element>
+                       </element>
+               </if>
+       </template>
+       <template match="@rdf:about|@rdf:resource" mode="Vocab:render-individual">
+               <param name="root" select="/"/>
+               <variable name="resource" select="string()"/>
+               <for-each select="$root">
+                       <call-template name="Vocab:link-to">
+                               <with-param name="resource" select="$resource"/>
+                               <with-param name="kind" select="'individual'"/>
+                       </call-template>
+               </for-each>
+       </template>
+       <template match="*" mode="Vocab:render-individual">
+               <text>??</text>
+       </template>
+       <template match="owl:AnnotationProperty|owl:DatatypeProperty|rdf:Description" mode="Vocab:render-property">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <choose>
+                       <when test="@rdf:about">
+                               <apply-templates select="@rdf:about" mode="Vocab:render-property">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                               </apply-templates>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-property">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+       </template>
+       <template match="owl:ObjectProperty" mode="Vocab:render-property">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <choose>
+                       <when test="@rdf:about">
+                               <apply-templates select="@rdf:about" mode="Vocab:render-property">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                               </apply-templates>
+                       </when>
+                       <when test="owl:inverseOf">
+                               <text>inverse </text>
+                               <apply-templates select="(owl:inverseOf/@rdf:resource|owl:inverseOf/*)[1]" mode="Vocab:render-property">
+                                       <with-param name="root" select="$root"/>
+                                       <with-param name="resource-context" select="$resource-context"/>
+                               </apply-templates>
+                       </when>
+                       <otherwise>
+                               <text>??</text>
+                       </otherwise>
+               </choose>
+               <apply-templates select="Vocabvocab:inferred-from" mode="Vocab:render-property">
+                       <with-param name="root" select="$root"/>
+                       <with-param name="resource-context" select="$resource-context"/>
+               </apply-templates>
+       </template>
+       <template match="Vocabvocab:inferred-from" mode="Vocab:render-property">
+               <param name="root" select="/"/>
+               <param name="resource-context"/>
+               <if test="string($resource-context)='' or string(@rdf:resource)!=$resource-context">
+                       <text> </text>
+                       <element name="html:details">
+                               <attribute name="class">
+                                       <text>inference</text>
+                               </attribute>
+                               <element name="html:summary">
+                                       <call-template name="Vocab:more-info"/>
+                               </element>
+                               <element name="html:div">
+                                       <element name="html:span">
+                                               &en;
+                                               <text>implied by</text>
+                                       </element>
+                                       <text> </text>
+                                       <apply-templates select="@rdf:resource" mode="Vocab:render-property">
+                                               <with-param name="root" select="$root"/>
+                                       </apply-templates>
+                               </element>
+                       </element>
+               </if>
+       </template>
+       <template match="@rdf:about|@rdf:resource" mode="Vocab:render-property">
+               <param name="root" select="/"/>
+               <variable name="resource" select="string()"/>
+               <for-each select="$root">
+                       <call-template name="Vocab:link-to">
+                               <with-param name="resource" select="$resource"/>
+                               <with-param name="kind" select="'property'"/>
+                       </call-template>
+               </for-each>
+       </template>
+       <template match="*" mode="Vocab:render-property">
+               <text>??</text>
+       </template>
+       <template match="*" mode="Vocab:render-value">
+               <param name="root" select="/"/>
+               <element name="html:code">
+                       <text>&quot;</text>
+                       <element name="html:span">
+                               <if test="string(@xml:lang)!=''">
+                                       <attribute name="lang">
+                                               <value-of select="@xml:lang"/>
+                                       </attribute>
+                                       <attribute name="xml:lang">
+                                               <value-of select="@xml:lang"/>
+                                       </attribute>
+                               </if>
+                               <value-of select="."/>
+                       </element>
+                       <text>&quot;</text>
+                       <choose>
+                               <when test="string(@xml:lang)!=''">
+                                       <text>@</text>
+                                       <value-of select="@xml:lang"/>
+                               </when>
+                               <when test="@rdf:datatype and string(@rdf:datatype)!='http://www.w3.org/2001/XMLSchema#string'">
+                                       <text>^^</text>
+                                       <for-each select="/">
+                                               <call-template name="Vocab:link-to">
+                                                       <with-param name="resource" select="@rdf:datatype"/>
+                                                       <with-param name="kind" select="'class'"/>
+                                               </call-template>
+                                       </for-each>
+                               </when>
+                       </choose>
+               </element>
+       </template>
+</transform>
This page took 0.036844 seconds and 4 git commands to generate.