]> Lady’s Gitweb - Shushe/commitdiff
Generate destinations and dependencies as metadata
authorLady <redacted>
Sun, 2 Jun 2024 01:31:55 +0000 (21:31 -0400)
committerLady <redacted>
Thu, 11 Jul 2024 01:46:30 +0000 (21:46 -0400)
The format of this is subject to change. It might actually be desirable
to have the dependency and destination files be side·effects of the
metadata file generated alongside it (in the same `xsltproc` call)
rather than needing to generate them separately.

GNUmakefile
lib/expandmetadata.xslt [new file with mode: 0644]
lib/metadata2dependencies.xslt
lib/metadata2destinations.xslt

index ecaade9f7d3e46a4c491190bc6a6c5f8f02380d3..99e94cfff10d973b4d452fa744d5a2837ec580ef 100644 (file)
@@ -434,8 +434,8 @@ override parsed = $(foreach file,$1,$(patsubst $(file)|%,%,$(filter $(file)|%,$(
 # (callable) Get the source files for the given parsed file.
 override unparsed = $(foreach file,$1,$(patsubst %|$(file),%,$(filter %|$(file),$(sourceparsedpair))))
 
-# Pair each parser, transform, source file, parsed file, or metadata compilation with its file u·r·i.
-override fileuripairs := $(join $(patsubst %,%|,$(PARSERS) $(TRANSFORMS) $(sourcefiles) $(sourceincludes) $(call parsed,$(sourcefiles) $(sourceincludes)) $(BUILDDIR)/metadata),$(call pathenc,$(foreach uriable,$(PARSERS) $(TRANSFORMS) $(sourcefiles) $(sourceincludes) $(call parsed,$(sourcefiles) $(sourceincludes)) $(BUILDDIR)/metadata,file://$(abspath $(uriable)))))
+# Pair each build directory, parser, transform, or source file with its file u·r·i.
+override fileuripairs := $(join $(patsubst %,%|,$(BUILDDIR) $(PARSERS) $(TRANSFORMS) $(sourcefiles) $(sourceincludes)),$(call pathenc,$(foreach uriable,$(BUILDDIR) $(PARSERS) $(TRANSFORMS) $(sourcefiles) $(sourceincludes),file://$(abspath $(uriable)))))
 
 # (callable) Get the file u·r·is for the given parsers, transforms, parsed files, or metadata compilations.
 override fileuri = $(foreach file,$1,$(or $(patsubst $(file)|%,%,$(filter $(file)|%,$(fileuripairs))),$(error Unable to get file u·r·i for `$(file)´)))
@@ -480,10 +480,10 @@ override destinations := $(shell $(CAT) $(BUILDDIR)/destinations)
 # Pair source files and their destinations.
 override sourcedestinationpair := $(foreach destination,$(destinations),$(call sourcefile,$(firstword $(subst |, ,$(destination))))|$(call perdec,$(subst $(space),|,$(wordlist 2,$(words $(subst |, ,$(destination))),$(subst |, ,$(destination))))))
 
-# (callable) Get the destination for the given source files, or return `NOTDEF´.
+# (callable) Get the destination for the given source files, or return `.NOTDEF/$1´.
 #
-# The fallback here is because destinations are used to generate targets and thus must always be non·empty, even when they haven’t been generated yet.
-override destination = $(foreach file,$1,$(or $(patsubst $(file)|%,%,$(filter $(file)|%,$(sourcedestinationpair))),NOTDEF))
+# The fallback here is because destinations are used to generate targets and thus must always be non·empty and should be unique, even when they haven’t been generated yet.
+override destination = $(foreach file,$1,$(or $(patsubst $(file)|%,%,$(filter $(file)|%,$(sourcedestinationpair))),.NOTDEF/$1))
 
 # Pair each source file with its compiled location.
 override sourcecompiledpair := $(foreach file,$(sourcefiles),$(file)|$(BUILDDIR)/results/$(call destination,$(file)))
@@ -634,7 +634,7 @@ $(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2pars
 $(call metadata,$(sourcefiles) $(sourceincludes)) : % : $$(call datadata,$$@) $(typeupdates)
        $(call inform,$(PRINTF) '%s\n' $(call quote,Generating metadata for `$<´…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
-       $(silent){ if $(TEST) ! -f $(call quote,$(BUILDDIR)/.mtime); then $(PRINTF) '%b' '\n' >|$(call quote,$(BUILDDIR)/.mtime); fi; $(TOUCH) -r $(call quote,$<) $(call quote,$(BUILDDIR)/.mtime); $(DIFF) -u $(call quote,$(BUILDDIR)/.mtime) /dev/null | $(SED) '1!d;s/.*   \([^ ]*\) \([^ ]*\).*$$/\1T\2Z/'; $(CKSUM) $(call quote,$<) | $(SED) 's/[ ].*//'; } | $(xargsmultiquote) | $(XARGS) -E '' $(PRINTF) '<?xml version="1.0"?><nfo:LocalFileDataObject xmlns:dct="http://purl.org/dc/terms/" xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#" xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="%s" nfo:fileName="%s" nfo:fileUrl="%s"><nie:interpretedAs>$(if $(filter $<,$(assetfiles)),<nfo:InformationElement nie:mimeType="%s"/>,<nfo:PlainTextDocument nie:mimeType="%s"/>)</nie:interpretedAs><dct:hasFormat><nfo:LocalFileDataObject nfo:fileUrl="%s"><nie:interpretedAs><nfo:PlainTextDocument nie:mimeType="application/xml"/></nie:interpretedAs></nfo:LocalFileDataObject></dct:hasFormat><nfo:fileLastModified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">%s</nfo:fileLastModified><nfo:hasHash nfo:hashAlgorithm="CRC32" nfo:hashValue="%s"/></nfo:LocalFileDataObject>' $(call quote,$(call attresc,$(call localuri,$<))) $(call quote,$(call attresc,$(notdir $<))) $(call quote,$(call attresc,$(call fileuri,$<))) $(call quote,$(call attresc,$(call typeoffile,$<))) $(call quote,$(call attresc,$(call fileuri,$(call parsed,$<)))) >|$(call quote,$@)
+       $(silent){ if $(TEST) ! -f $(call quote,$(BUILDDIR)/.mtime); then $(PRINTF) '%b' '\n' >|$(call quote,$(BUILDDIR)/.mtime); fi; $(TOUCH) -r $(call quote,$<) $(call quote,$(BUILDDIR)/.mtime); $(DIFF) -u $(call quote,$(BUILDDIR)/.mtime) /dev/null | $(SED) '1!d;s/.*   \([^ ]*\) \([^ ]*\).*$$/\1T\2Z/'; $(CKSUM) $(call quote,$<) | $(SED) 's/[ ].*//'; } | $(xargsmultiquote) | $(XARGS) -E '' $(PRINTF) '<?xml version="1.0"?><nfo:LocalFileDataObject xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#" xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="%s" nfo:fileName="%s" nfo:fileUrl="%s"><nie:interpretedAs>$(if $(filter $<,$(assetfiles)),<nfo:InformationElement nie:mimeType="%s"/>,<nfo:PlainTextDocument nie:mimeType="%s"/>)</nie:interpretedAs><nfo:fileLastModified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">%s</nfo:fileLastModified><nfo:hasHash nfo:hashAlgorithm="CRC32" nfo:hashValue="%s"/></nfo:LocalFileDataObject>' $(call quote,$(call attresc,$(call localuri,$<))) $(call quote,$(call attresc,$(if $(filter $<,$(sourceincludes)),$(call includepath,$<),$(call sourcepath,$<)))) $(call quote,$(call attresc,$(call fileuri,$<))) $(call quote,$(call attresc,$(call typeoffile,$<))) >|$(call quote,$@)
 
 # Parse the files.
 #
@@ -646,12 +646,12 @@ $(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(BU
        $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,<?xml version="1.0"?><object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$<)" data="$(call datauri,$<)"/>) >|$(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(call serializexml,$<)) | $(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam BUILDTIME $$($(DATE) -u '+%Y-%m-%dT%H:%M:%SZ') --stringparam IDENTIFIER $(call quote,$(call localuri,$<))$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/parser.xslt) - >|$(call quote,$@))
 
 # Collect the metadata into a single file.
-$(BUILDDIR)/metadata : $(call diffprereqs,metadatas,$(call metadata,$(sort $(sourcefiles) $(sourceincludes))))
+$(BUILDDIR)/metadata : $(call diffprereqs,metadatas,$(call metadata,$(sort $(sourcefiles) $(sourceincludes)))) $(call parsed,$(filter-out $(assetfiles),$(sourcefiles) $(sourceincludes))) $(THISDIR)/lib/expandmetadata.xslt
        $(call inform,$(PRINTF) '%s\n' 'Compiling metadata…' >&2)
-       $(silent){ $(PRINTF) '%s' '<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'; $(foreach meta,$(call metadata,$(sort $(sourcefiles) $(sourceincludes))),$(CAT) $(call quote,$(meta)) | $(SED) 's/<?xml version="1.0"?>//';) $(PRINTF) '%s\n' '</rdf:RDF>'; } >|$(call quote,$@)
+       $(silent){ $(PRINTF) '<?xml version="1.0"?><rdf:RDF xmlns:dct="http://purl.org/dc/terms/" xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#" xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"><nfo:LocalFileDataObject rdf:about="about:shushe?builddir" nfo:fileUrl="%s"><nie:interpretedAs><nfo:Folder/></nie:interpretedAs></nfo:LocalFileDataObject>' $(call quote,$(call attresc,$(call fileuri,$(BUILDDIR)))); { $(foreach meta,$(call metadata,$(sort $(sourcefiles) $(sourceincludes))),$(CAT) $(call quote,$(meta));) } | $(SED) 's/<?xml version="1.0"?>//g'; $(PRINTF) '%s\n' '</rdf:RDF>'; } | $(XSLTPROC) --nonet --novalid --nomkdir --nowrite $(call quote,$(THISDIR)/lib/expandmetadata.xslt) - | $(XMLLINT) --nonet --nsclean - >|$(call quote,$@)
 
 # Build a list of dependencies for each parsed file.
-$(BUILDDIR)/dependencies : $(BUILDDIR)/metadata $(call parsed,$(filter-out $(assetfiles),$(sourcefiles) $(sourceincludes))) $(THISDIR)/lib/metadata2dependencies.xslt
+$(BUILDDIR)/dependencies : $(BUILDDIR)/metadata $(THISDIR)/lib/metadata2dependencies.xslt
        $(call inform,$(PRINTF) '%s\n' 'Identifying dependencies…' >&2)
        $(silent)$(TOUCH) $(call quote,$@)
        $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite $(call quote,$(THISDIR)/lib/metadata2dependencies.xslt) $(call quote,$<) >|$(call quote,$@)
@@ -660,7 +660,7 @@ $(BUILDDIR)/dependencies : $(BUILDDIR)/metadata $(call parsed,$(filter-out $(ass
 #
 # This depends on parsing non·asset source files, but not assets or includes.
 # It does not require knowing the dependencies.
-$(BUILDDIR)/destinations : $(BUILDDIR)/metadata $(call parsed,$(filter-out $(assetfiles),$(sourcefiles))) $(THISDIR)/lib/metadata2destinations.xslt
+$(BUILDDIR)/destinations : $(BUILDDIR)/metadata $(THISDIR)/lib/metadata2destinations.xslt
        $(call inform,$(PRINTF) '%s\n' 'Identifying output destinations…' >&2)
        $(silent)$(TOUCH) $(call quote,$@)
        $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite $(call quote,$(THISDIR)/lib/metadata2destinations.xslt) $(call quote,$<) >|$(call quote,$@)
@@ -672,7 +672,7 @@ $(BUILDDIR)/transform.catalog : $(call diffprereqs,transforms,$(sort $(TRANSFORM
        $(foreach transform,$(TRANSFORMS),$(silent){ $(call id,$(transform)); $(PRINTF) '%s\n' $(call quote,$(call fileuri,$(transform))) '--noout' $(call quote,$@); } | $(xargsmultiquote) | $(XARGS) -E '' $(XMLCATALOG) --add uri$(newline))
 $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(BUILDDIR)/metadata $(THISDIR)/lib/catalog2transform.xslt
        $(call inform,$(PRINTF) '%s\n' 'Generating main transform…' >&2)
-       $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA $(call quote,$(call fileuri,$(BUILDDIR)/metadata)) $(call quote,$(THISDIR)/lib/catalog2transform.xslt) $(call quote,$<) >|$(call quote,$@)
+       $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA $(call quote,$(call fileuri,$(BUILDDIR))/metadata) $(call quote,$(THISDIR)/lib/catalog2transform.xslt) $(call quote,$<) >|$(call quote,$@)
 
 # Compile the result files using the dependencies as necessary.
 $(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.xslt $(BUILDDIR)/metadata
diff --git a/lib/expandmetadata.xslt b/lib/expandmetadata.xslt
new file mode 100644 (file)
index 0000000..e75fe23
--- /dev/null
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+<!--
+SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
+SPDX-License-Identifier: MPL-2.0
+-->
+<!--
+⁌ ⛩📰 书社 ∷ lib/expandmetadata.xslt
+
+© 2023–2024 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/>.
+-->
+<transform
+       xmlns="http://www.w3.org/1999/XSL/Transform"
+       xmlns:dct="http://purl.org/dc/terms/"
+       xmlns:exsl="http://exslt.org/common"
+       xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#"
+       xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
+       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+       xmlns:xlink="http://www.w3.org/1999/xlink"
+       xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
+       xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"
+       extension-element-prefixes="exsl"
+       version="1.0"
+>
+       <variable name="builddir" select="//*[@rdf:about='about:shushe?builddir']/@nfo:fileUrl"/>
+       <variable name="files" select="/rdf:RDF/nfo:LocalFileDataObject[not(nie:interpretedAs/nfo:Folder)]"/>
+       <template name="书社:process-dependencies">
+               <param name="processed"/>
+               <param name="unprocessed"/>
+               <variable name="queue">
+                       <copy-of select="exsl:node-set($unprocessed)/书社:dependency-root"/>
+                       <for-each select="exsl:node-set($unprocessed)/书社:dependency">
+                               <if test="not((exsl:node-set($processed)/书社:*|preceding-sibling::书社:*|following-sibling::书社:recursive-dependency)[string()=string(current())])">
+                                       <copy-of select="."/>
+                               </if>
+                       </for-each>
+               </variable>
+               <variable name="old">
+                       <copy-of select="exsl:node-set($processed)/书社:dependency-root"/>
+                       <copy-of select="exsl:node-set($processed)/书社:recursive-dependency"/>
+                       <for-each select="exsl:node-set($unprocessed)/书社:recursive-dependency">
+                               <if test="not((exsl:node-set($processed)/书社:recursive-dependency|preceding-sibling::书社:recursive-dependency)[string()=string(current())])">
+                                       <copy-of select="."/>
+                               </if>
+                       </for-each>
+                       <for-each select="exsl:node-set($processed)/书社:dependency">
+                               <if test="not(exsl:node-set($unprocessed)/书社:recursive-dependency[string()=string(current())])">
+                                       <copy-of select="."/>
+                               </if>
+                       </for-each>
+                       <copy-of select="$queue"/>
+               </variable>
+               <variable name="new">
+                       <for-each select="exsl:node-set($queue)/书社:*">
+                               <for-each select="$files[@rdf:about=string(current()) and nie:interpretedAs/nfo:PlainTextDocument]">
+                                       <variable name="parent" select="@rdf:about"/>
+                                       <variable name="subdir">
+                                               <choose>
+                                                       <when test="starts-with($parent, 'about:shushe?include=')">
+                                                               <text>/includes/</text>
+                                                       </when>
+                                                       <when test="starts-with($parent, 'about:shushe?source=')">
+                                                               <text>/sources/</text>
+                                                       </when>
+                                               </choose>
+                                       </variable>
+                                       <for-each select="document(concat($builddir, $subdir, @nfo:fileName), .)//书社:link[@xlink:show='embed']">
+                                               <if test="exsl:node-set($old)/书社:dependency-root[string()=string(current()/@xlink:href)]">
+                                                       <书社:recursive-dependency>
+                                                               <value-of select="$parent"/>
+                                                       </书社:recursive-dependency>
+                                               </if>
+                                               <if test="$files/@rdf:about[string()=string(current()/@xlink:href)]">
+                                                       <书社:dependency>
+                                                               <value-of select="@xlink:href"/>
+                                                       </书社:dependency>
+                                               </if>
+                                       </for-each>
+                               </for-each>
+                       </for-each>
+               </variable>
+               <choose>
+                       <when test="exsl:node-set($new)/书社:dependency">
+                               <call-template name="书社:process-dependencies">
+                                       <with-param name="processed">
+                                               <copy-of select="$old"/>
+                                       </with-param>
+                                       <with-param name="unprocessed">
+                                               <copy-of select="$new"/>
+                                       </with-param>
+                               </call-template>
+                       </when>
+                       <otherwise>
+                               <copy-of select="$old"/>
+                       </otherwise>
+               </choose>
+       </template>
+       <template match="rdf:RDF/nfo:LocalFileDataObject[not(nie:interpretedAs/nfo:Folder or nie:interpretedAs/nfo:PlainTextDocument)]" priority="1">
+               <copy>
+                       <apply-templates select="@*|node()"/>
+                       <if test="starts-with(@rdf:about, 'about:shushe?source=')">
+                               <dct:hasFormat>
+                                       <nfo:LocalFileDataObject dct:creator="urn:fdc:ladys.computer:20231231:Shu1She4" nfo:fileName="{substring-after(@rdf:about, 'about:shushe?source=')}"/>
+                               </dct:hasFormat>
+                       </if>
+               </copy>
+       </template>
+       <template match="rdf:RDF/nfo:LocalFileDataObject[nie:interpretedAs/nfo:PlainTextDocument]" priority="1">
+               <variable name="parsed" select="document(concat($builddir, '/sources/', @nfo:fileName), .)"/>
+               <variable name="destination-delim" select="concat('/', $parsed/*/@书社:destination, '/')"/>
+               <variable name="destination">
+                       <choose>
+                               <when test="not(starts-with(@rdf:about, 'about:shushe?source='))"/>
+                               <when test="not(contains($destination-delim, '//') or contains($destination-delim, '/./') or contains($destination-delim, '/../'))">
+                                       <value-of select="$parsed/*/@书社:destination"/>
+                               </when>
+                               <otherwise>
+                                       <value-of select="substring-after(@rdf:about, 'about:shushe?source=')"/>
+                               </otherwise>
+                       </choose>
+               </variable>
+               <variable name="dependencies-fragment">
+                       <apply-templates select="." mode="书社:dependencies"/>
+               </variable>
+               <variable name="dependencies" select="exsl:node-set($dependencies)"/>
+               <copy>
+                       <apply-templates select="@*|node()"/>
+                       <for-each select="$dependencies/书社:dependency">
+                               <书社vocab:hasDependencyOn rdf:resource="{.}"/>
+                       </for-each>
+                       <for-each select="$dependencies/书社:recursive-dependency">
+                               <书社vocab:hasRecursiveDependencyOn rdf:resource="{.}"/>
+                       </for-each>
+                       <if test="$destination!=''">
+                               <dct:hasFormat>
+                                       <nfo:LocalFileDataObject dct:creator="urn:fdc:ladys.computer:20231231:Shu1She4" nfo:fileName="{$destination}">
+                                       </nfo:LocalFileDataObject>
+                               </dct:hasFormat>
+                       </if>
+               </copy>
+       </template>
+       <template match="@*|node()">
+               <copy>
+                       <apply-templates select="@*|node()"/>
+               </copy>
+       </template>
+       <template match="nfo:LocalFileDataObject" mode="书社:dependencies">
+               <if test="nie:interpretedAs/nfo:PlainTextDocument">
+                       <call-template name="书社:process-dependencies">
+                               <with-param name="unprocessed">
+                                       <书社:dependency-root>
+                                               <value-of select="@rdf:about"/>
+                                       </书社:dependency-root>
+                               </with-param>
+                       </call-template>
+               </if>
+       </template>
+</transform>
index 4d08ba15f124453f056007b70224cb3897e47129..7bbd4facd5dcc88065aa399b89780f6e96afa000 100644 (file)
@@ -13,103 +13,23 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 -->
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
-       xmlns:dct="http://purl.org/dc/terms/"
-       xmlns:exsl="http://exslt.org/common"
        xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#"
        xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-       xmlns:xlink="http://www.w3.org/1999/xlink"
-       xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
+       xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"
        version="1.0"
 >
-       <variable name="files" select="/rdf:RDF/nfo:LocalFileDataObject"/>
-       <template name="书社:process-dependencies">
-               <param name="processed"/>
-               <param name="unprocessed"/>
-               <variable name="queue">
-                       <copy-of select="exsl:node-set($unprocessed)/书社:dependency-root"/>
-                       <for-each select="exsl:node-set($unprocessed)/书社:dependency">
-                               <if test="not((exsl:node-set($processed)/书社:*|preceding-sibling::书社:*|following-sibling::书社:recursive-dependency)[string()=string(current())])">
-                                       <copy-of select="."/>
-                               </if>
-                       </for-each>
-               </variable>
-               <variable name="old">
-                       <copy-of select="exsl:node-set($processed)/书社:dependency-root"/>
-                       <copy-of select="exsl:node-set($processed)/书社:recursive-dependency"/>
-                       <for-each select="exsl:node-set($unprocessed)/书社:recursive-dependency">
-                               <if test="not((exsl:node-set($processed)/书社:recursive-dependency|preceding-sibling::书社:recursive-dependency)[string()=string(current())])">
-                                       <copy-of select="."/>
-                               </if>
-                       </for-each>
-                       <for-each select="exsl:node-set($processed)/书社:dependency">
-                               <if test="not(exsl:node-set($unprocessed)/书社:recursive-dependency[string()=string(current())])">
-                                       <copy-of select="."/>
-                               </if>
-                       </for-each>
-                       <copy-of select="$queue"/>
-               </variable>
-               <variable name="new">
-                       <for-each select="exsl:node-set($queue)/书社:*">
-                               <for-each select="$files[@rdf:about=string(current()) and nie:interpretedAs/nfo:PlainTextDocument and dct:hasFormat/*/nie:interpretedAs/*[@nie:mimeType='application/xml']]">
-                                       <variable name="parent" select="@rdf:about"/>
-                                       <for-each select="document(dct:hasFormat/*[nie:interpretedAs/*[@nie:mimeType='application/xml']]/@nfo:fileUrl[1])//书社:link[@xlink:show='embed']">
-                                               <if test="exsl:node-set($old)/书社:dependency-root[string()=string(current()/@xlink:href)]">
-                                                       <书社:recursive-dependency>
-                                                               <value-of select="$parent"/>
-                                                       </书社:recursive-dependency>
-                                               </if>
-                                               <if test="$files/@rdf:about[string()=string(current()/@xlink:href)]">
-                                                       <书社:dependency>
-                                                               <value-of select="@xlink:href"/>
-                                                       </书社:dependency>
-                                               </if>
-                                       </for-each>
-                               </for-each>
-                       </for-each>
-               </variable>
-               <choose>
-                       <when test="exsl:node-set($new)/书社:dependency">
-                               <call-template name="书社:process-dependencies">
-                                       <with-param name="processed">
-                                               <copy-of select="$old"/>
-                                       </with-param>
-                                       <with-param name="unprocessed">
-                                               <copy-of select="$new"/>
-                                       </with-param>
-                               </call-template>
-                       </when>
-                       <otherwise>
-                               <copy-of select="$old"/>
-                       </otherwise>
-               </choose>
-       </template>
-       <template match="nfo:LocalFileDataObject" mode="书社:dependencies">
-               <if test="nie:interpretedAs/nfo:PlainTextDocument">
-                       <call-template name="书社:process-dependencies">
-                               <with-param name="unprocessed">
-                                       <书社:dependency-root>
-                                               <value-of select="@rdf:about"/>
-                                       </书社:dependency-root>
-                               </with-param>
-                       </call-template>
-               </if>
-       </template>
        <template match="/">
-               <for-each select="$files[nie:interpretedAs/nfo:PlainTextDocument]">
-                       <variable name="parent" select="@rdf:about"/>
-                       <variable name="dependencies">
-                               <apply-templates select="." mode="书社:dependencies"/>
-                       </variable>
+               <for-each select="rdf:RDF/nfo:LocalFileDataObject[nie:interpretedAs/nfo:PlainTextDocument]">
                        <value-of select="@rdf:about"/>
                        <text>&#xA;</text>
-                       <for-each select="exsl:node-set($dependencies)/书社:recursive-dependency">
+                       <for-each select="书社vocab:hasRecursiveDependencyOn/@rdf:resource">
                                <text>&#x9;</text>
                                <text>-</text>
                                <value-of select="."/>
                                <text>&#xA;</text>
                        </for-each>
-                       <for-each select="exsl:node-set($dependencies)/书社:dependency">
+                       <for-each select="书社vocab:hasDependencyOn/@rdf:resource">
                                <text>&#x9;</text>
                                <value-of select="."/>
                                <text>&#xA;</text>
index cf18945456f10871b0ee605a20895f8f02d9c0f5..e1fe1cd6a19725a04dec4f81aa0462081ca01b4e 100644 (file)
@@ -14,38 +14,16 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:dct="http://purl.org/dc/terms/"
-       xmlns:exslstr="http://exslt.org/strings"
-       xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#"
        xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-       xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
-       extension-element-prefixes="exslstr"
        version="1.0"
 >
        <template match="/">
                <for-each select="/rdf:RDF/nfo:LocalFileDataObject[starts-with(@rdf:about, 'about:shushe?source=')]">
-                       <choose>
-                               <when test="nie:interpretedAs/nfo:PlainTextDocument and dct:hasFormat/*/nie:interpretedAs/*[@nie:mimeType='application/xml']">
-                                       <variable name="destination" select="document(dct:hasFormat/*[nie:interpretedAs/*[@nie:mimeType='application/xml']]/@nfo:fileUrl[1])/*/@书社:destination"/>
-                                       <value-of select="@rdf:about"/>
-                                       <text>|</text>
-                                       <choose>
-                                               <when test="$destination">
-                                                       <value-of select="$destination"/>
-                                               </when>
-                                               <otherwise>
-                                                       <value-of select="substring-after(@rdf:about, 'about:shushe?source=')"/>
-                                               </otherwise>
-                                       </choose>
-                                       <text>&#xA;</text>
-                               </when>
-                               <otherwise>
-                                       <value-of select="@rdf:about"/>
-                                       <text>|</text>
-                                       <value-of select="substring-after(@rdf:about, 'about:shushe?source=')"/>
-                                       <text>&#xA;</text>
-                               </otherwise>
-                       </choose>
+                       <value-of select="@rdf:about"/>
+                       <text>|</text>
+                       <value-of select="dct:hasFormat/nfo:LocalFileDataObject[@dct:creator='urn:fdc:ladys.computer:20231231:Shu1She4']/@nfo:fileName"/>
+                       <text>&#xA;</text>
                </for-each>
        </template>
        <output method="text" encoding="UTF-8"/>
This page took 0.096633 seconds and 4 git commands to generate.