+<?xml version="1.0"?>
+<!--
+SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
+SPDX-License-Identifier: MPL-2.0
+-->
+<!--
+⁌ 📰 Caudex ∷ transform.xslt
+
+© 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 xhtml 'http://www.w3.org/1999/xhtml'>
+ <!ENTITY 书社 'urn:fdc:ladys.computer:20231231:Shu1She4'>
+]>
+<transform
+ xmlns="http://www.w3.org/1999/XSL/Transform"
+ xmlns:Caudex="urn:fdc:ladys.computer:20240204:Caudex"
+ xmlns:awol="http://bblfish.net/work/atom-owl/2006-06-06/#"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:exslstr="http://exslt.org/strings"
+ xmlns:html="&xhtml;"
+ xmlns:ore="http://www.openarchives.org/ore/terms/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:skos="http://www.w3.org/2004/02/skos/core#"
+ xmlns:书社="&书社;"
+ extension-element-prefixes="exsl exslstr"
+ version="1.0"
+>
+ <书社:id>urn:fdc:ladys.computer:20240204:Caudex:transform.xslt</书社:id>
+ <template match="@id" mode="Caudex:codex-entry" priority="0">
+ <attribute name="id">
+ <value-of select="ancestor::*[skos:notation][1]/skos:notation"/>
+ <text>.</text>
+ <value-of select="."/>
+ </attribute>
+ </template>
+ <template match="@href[starts-with(., '#')]" mode="Caudex:codex-entry" priority="0">
+ <attribute name="href">
+ <text>#</text>
+ <value-of select="ancestor::*[skos:notation][1]/skos:notation"/>
+ <text>.</text>
+ <value-of select="substring-after(., '#')"/>
+ </attribute>
+ </template>
+ <template match="@*|node()" mode="Caudex:codex-entry" priority="-1">
+ <copy>
+ <apply-templates select="@*|node()" mode="Caudex:codex-entry"/>
+ </copy>
+ </template>
+ <template match="Caudex:codex" mode="书社:expand" priority="1">
+ <variable name="codex-fragment">
+ <apply-templates select="node()" mode="书社:expand"/>
+ </variable>
+ <variable name="codex" select="exsl:node-set($codex-fragment)"/>
+ <variable name="codex-rdf" select="$codex//ore:Aggregation[@rdf:nodeID='codex']"/>
+ <element name="书社:archive">
+ <attribute name="书社:expanded"/>
+ <for-each select="$codex-rdf">
+ <variable name="title-fragment">
+ <if test="@dcterms:title">
+ <element name="meta" namespace="&xhtml;">
+ <attribute name="itemprop">
+ <text>urn:fdc:ladys.computer:20231231:Shu1She4:title</text>
+ </attribute>
+ <attribute name="content">
+ <value-of select="@dcterms:title"/>
+ </attribute>
+ </element>
+ </if>
+ </variable>
+ <variable name="navigation-fragment">
+ <element name="nav" namespace="&xhtml;">
+ <element name="ul" namespace="&xhtml;">
+ <for-each select="$codex//awol:Category">
+ <variable name="category-id" select="string(@rdf:nodeID)"/>
+ <element name="li" namespace="&xhtml;">
+ <element name="strong" namespace="&xhtml;">
+ <value-of select="@awol:term"/>
+ </element>
+ <element name="ul" namespace="&xhtml;">
+ <for-each select="$codex//ore:Proxy[ore:proxyIn/@rdf:nodeID='codex' and awol:category/@rdf:nodeID=$category-id]">
+ <sort select="@dcterms:title"/>
+ <sort select="skos:notation"/>
+ <element name="li" namespace="&xhtml;">
+ <element name="a" namespace="&xhtml;">
+ <attribute name="href">
+ <text>./</text>
+ <value-of select="skos:notation"/>
+ <text>.xhtml</text>
+ </attribute>
+ <attribute name="data-identifier">
+ <value-of select="skos:notation"/>
+ </attribute>
+ <attribute name="data-cksum">
+ <value-of select="@书社:cksum"/>
+ </attribute>
+ <if test="@dcterms:title">
+ <value-of select="@dcterms:title"/>
+ <text> </text>
+ </if>
+ <element name="small" namespace="&xhtml;">
+ <text>(</text>
+ <element name="code" namespace="&xhtml;">
+ <attribute name="lang">
+ <text>zxx</text>
+ </attribute>
+ <attribute name="xml:lang">
+ <text>zxx</text>
+ </attribute>
+ <value-of select="skos:notation"/>
+ </element>
+ <text>)</text>
+ </element>
+ </element>
+ </element>
+ </for-each>
+ </element>
+ </element>
+ </for-each>
+ </element>
+ </element>
+ </variable>
+ <element name="div" namespace="&xhtml;">
+ <attribute name="Caudex:page">
+ <text>index</text>
+ </attribute>
+ <attribute name="书社:archived-as">
+ <text>index.xhtml</text>
+ </attribute>
+ <copy-of select="$title-fragment"/>
+ <element name="main" namespace="&xhtml;">
+ <copy-of select="$navigation-fragment"/>
+ <element name="div" namespace="&xhtml;">
+ <attribute name="id">
+ <text>Caudex.pane</text>
+ </attribute>
+ </element>
+ </element>
+ <element name="script" namespace="&xhtml;">
+ <attribute name="type">
+ <text>text/javascript</text>
+ </attribute>
+ <text><![CDATA[#!javascript
+~function(links){
+ var i=0
+ var cache={}
+ for(;i<links.length;++i){
+ ~function(link){
+ var identifier=link.getAttribute("data-identifier")
+ var cksum=link.getAttribute("data-cksum")
+ if(!(identifier&&cksum))return
+ link.addEventListener("click",function(event){
+ var pane=document.getElementById("Caudex.pane")
+ var request
+ if(identifier in cache){
+ pane.textContent=""
+ pane.appendChild(document.importNode(cache[identifier],true))
+ }else{
+ pane.textContent="Loading…"
+ request=new XMLHttpRequest
+ request.open("GET",link.href)
+ request.addEventListener("load",function(){
+ var k=0
+ var article=request.responseXML.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","article").item(0)
+ cache[identifier]=article
+ pane.textContent=""
+ pane.appendChild(document.importNode(article,true))
+ for(;k<links.length;++k){
+ ~function(linkk){
+ var parent=linkk.parentNode
+ if(linkk==link)parent.setAttribute("class","selected")
+ else parent.setAttribute("class","")
+ }(links.item(k))
+ }
+ link.setAttribute("class","cached read")
+ try{
+ localStorage.setItem(identifier,cksum)
+ }catch(e){}
+ },false)
+ request.responseType="document"
+ request.send()
+ }
+ event.preventDefault()
+ pane.focus()
+ },false)
+ try{
+ var lastReadCksum=localStorage.getItem(identifier)
+ if(lastReadCksum==cksum)link.setAttribute("class","read")
+ else if(lastReadCksum)link.setAttribute("class","updated")
+ else link.setAttribute("class","new")
+ }catch(e){}
+ }(links[i])
+ }
+}(document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","main")[0].children[0].getElementsByTagNameNS("http://www.w3.org/1999/xhtml","a"))
+]]></text>
+ </element>
+ </element>
+ <element name="div" namespace="&xhtml;">
+ <attribute name="Caudex:page">
+ <text>standalone</text>
+ </attribute>
+ <attribute name="书社:archived-as">
+ <text>standalone.xhtml</text>
+ </attribute>
+ <copy-of select="$title-fragment"/>
+ <element name="main" namespace="&xhtml;">
+ <copy-of select="$navigation-fragment"/>
+ <element name="div" namespace="&xhtml;">
+ <attribute name="id">
+ <text>Caudex.pane</text>
+ </attribute>
+ <for-each select="$codex//ore:Proxy">
+ <element name="article" namespace="&xhtml;">
+ <attribute name="id">
+ <value-of select="skos:notation"/>
+ </attribute>
+ <attribute name="hidden">
+ <text>hidden</text>
+ </attribute>
+ <apply-templates select="ore:proxyFor/*/awol:content/awol:body/node()" mode="Caudex:codex-entry"/>
+ </element>
+ </for-each>
+ </element>
+ </element>
+ <element name="script" namespace="&xhtml;">
+ <attribute name="type">
+ <text>text/javascript</text>
+ </attribute>
+ <text><![CDATA[#!javascript
+~function(links){
+ var i=0
+ for(;i<links.length;++i){
+ ~function(link){
+ var identifier=link.getAttribute("data-identifier")
+ var cksum=link.getAttribute("data-cksum")
+ if(!(identifier&&cksum))return
+ link.addEventListener("click",function(event){
+ var j=0
+ var k=0
+ var pane=document.getElementById("Caudex.pane")
+ var articles=pane.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","article")
+ for(;j<articles.length;++j){
+ ~function(article){
+ if(article.getAttribute("id")==identifier){
+ article.removeAttribute("hidden")
+ link.setAttribute("class","cached read")
+ try{
+ localStorage.setItem(identifier,cksum)
+ }catch(e){}
+ }
+ else article.setAttribute("hidden","hidden")
+ }(articles.item(j))
+ }
+ for(;k<links.length;++k){
+ ~function(linkk){
+ var parent=linkk.parentNode
+ if(linkk==link)parent.setAttribute("class","selected")
+ else parent.setAttribute("class","")
+ }(links.item(k))
+ }
+ event.preventDefault()
+ pane.focus()
+ },false)
+ try{
+ var lastReadCksum=localStorage.getItem(identifier)
+ if(lastReadCksum==cksum)link.setAttribute("class","cached read")
+ else if(lastReadCksum)link.setAttribute("class","cached updated")
+ else link.setAttribute("class","cached new")
+ }catch(e){}
+ }(links.item(i))
+ }
+}(document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","main")[0].children[0].getElementsByTagNameNS("http://www.w3.org/1999/xhtml","a"))
+]]></text>
+ </element>
+ </element>
+ </for-each>
+ <for-each select="$codex//ore:Proxy">
+ <element name="article" namespace="&xhtml;">
+ <attribute name="Caudex:page">
+ <value-of select="skos:notation"/>
+ </attribute>
+ <attribute name="书社:archived-as">
+ <value-of select="skos:notation"/>
+ <text>.xhtml</text>
+ </attribute>
+ <if test="@dcterms:title">
+ <element name="meta" namespace="&xhtml;">
+ <attribute name="itemprop">
+ <text>urn:fdc:ladys.computer:20231231:Shu1She4:title</text>
+ </attribute>
+ <attribute name="content">
+ <value-of select="@dcterms:title"/>
+ </attribute>
+ </element>
+ </if>
+ <apply-templates select="ore:proxyFor/*/awol:content/awol:body/node()" mode="Caudex:codex-entry"/>
+ </element>
+ </for-each>
+ </element>
+ </template>
+ <template match="html:div[@itemtype='&书社;:document' and @Caudex:page]" mode="书社:metadata" priority="0">
+ <element name="style" namespace="&xhtml;">
+ <text><![CDATA[@charset "UTF-8";
+@namespace "http://www.w3.org/1999/xhtml";
+*[hidden]{Display:None}
+]]></text>
+ <if test="@Caudex:page='index' or @Caudex:page='standalone'">
+ <text><![CDATA[/*Index styling*/
+main{Display:Block;Width:100%;Height:100%}
+main>*{Display:Inline-Block;Box-Sizing:Border-Box;Border:.5EM Transparent None;Height:100%;Width:50%;Vertical-Align:Top;Overflow:Auto}
+main>nav{Border-Right-Style:Solid;Overflow:Scroll}
+main>div{Border-Left-Style:Solid}
+]]></text>
+ </if>
+ </element>
+ </template>
+</transform>