]> Lady’s Gitweb - Shushe/commitdiff
Simplify metadata using new 书社vocab terms 0.11.0
authorLady <redacted>
Sun, 2 Jun 2024 02:11:10 +0000 (22:11 -0400)
committerLady <redacted>
Thu, 11 Jul 2024 01:46:30 +0000 (21:46 -0400)
This commit also changes the behaviour of `@书社:destination`:
Formerly, the value of this attribute needed to be a percent·encoded;
now, it must _not_ be percent·encoded.

GNUmakefile
README.markdown
lib/catalog2transform.xslt
lib/expandmetadata.xslt
lib/metadata2dependencies.xslt
lib/metadata2destinations.xslt

index 99e94cfff10d973b4d452fa744d5a2837ec580ef..3c494320f0c2834f67bcc2ea4fde13570d42e138 100644 (file)
@@ -478,7 +478,8 @@ ifneq ($(wildcard $(BUILDDIR)/destinations),)
 override destinations := $(shell $(CAT) $(BUILDDIR)/destinations)
 
 # Pair source files and their destinations.
 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))))))
+override sourcedestinationpair := $(foreach destination,$(destinations),$(call sourcefile,$(firstword $(subst |, ,$(destination))))|$(subst $(space),|,$(wordlist 2,$(words $(subst |, ,$(destination))),$(subst |, ,$(destination)))))
+endif
 
 # (callable) Get the destination for the given source files, or return `.NOTDEF/$1´.
 #
 
 # (callable) Get the destination for the given source files, or return `.NOTDEF/$1´.
 #
@@ -502,7 +503,6 @@ override unbuilt = $(foreach file,$1,$(call uncompiled,$(patsubst $(BUILDDIR)/pu
 
 # (callable) Get the installed locations for the given source files.
 override installed = $(foreach file,$1,$(DESTDIR)/$(call destination,$(file)))
 
 # (callable) Get the installed locations for the given source files.
 override installed = $(foreach file,$1,$(DESTDIR)/$(call destination,$(file)))
-endif
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 
@@ -631,10 +631,12 @@ $(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2pars
        $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
 
 # Generate R·D·F metadata for files.
        $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
 
 # Generate R·D·F metadata for files.
-$(call metadata,$(sourcefiles) $(sourceincludes)) : % : $$(call datadata,$$@) $(typeupdates)
+#
+# This “depends” on `$(THISDIR)/lib/expandmetadata.xslt´ not because it is an actual dependency, but because a change to that file strongly suggests a change to these rules has occurred as well.
+$(call metadata,$(sourcefiles) $(sourceincludes)) : % : $$(call datadata,$$@) $(THISDIR)/lib/expandmetadata.xslt $(typeupdates)
        $(call inform,$(PRINTF) '%s\n' $(call quote,Generating metadata for `$<´…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(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: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,$@)
+       $(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"?><书社vocab:$(if $(filter $<,$(sourceincludes)),IncludeFile,SourceFile) 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:" rdf:about="%s" 书社vocab:path="%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"/></书社vocab:$(if $(filter $<,$(sourceincludes)),IncludeFile,SourceFile)>' $(call quote,$(call attresc,$(call localuri,$<))) $(call quote,$(call attresc,$(if $(filter $<,$(sourceincludes)),$(call includepath,$<),$(call sourcepath,$<)))) $(call quote,$(call attresc,$(call typeoffile,$<))) >|$(call quote,$@)
 
 # Parse the files.
 #
 
 # Parse the files.
 #
@@ -648,7 +650,7 @@ $(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(BU
 # Collect the metadata into a single file.
 $(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)
 # Collect the metadata into a single file.
 $(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) '<?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,$@)
+       $(silent){ $(PRINTF) '<?xml version="1.0"?><rdf:RDF 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:"><书社vocab:BuildDirectory nfo:fileUrl="%s"/>' $(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 $(THISDIR)/lib/metadata2dependencies.xslt
 
 # Build a list of dependencies for each parsed file.
 $(BUILDDIR)/dependencies : $(BUILDDIR)/metadata $(THISDIR)/lib/metadata2dependencies.xslt
@@ -678,7 +680,7 @@ $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(BUILDDIR)/metadata
 $(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.xslt $(BUILDDIR)/metadata
        $(call inform,$(PRINTF) '%s\n' $(call quote,Compiling </$*>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
 $(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.xslt $(BUILDDIR)/metadata
        $(call inform,$(PRINTF) '%s\n' $(call quote,Compiling </$*>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
-       $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA 'metadata' --stringparam BUILDTIME $$($(DATE) -u '+%Y-%m-%dT%H:%M:%SZ') --stringparam IDENTIFIER $(call quote,$(call localuri,$(call uncompiled,$@))) --stringparam PATH $(call quote,/$*)$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) >|$(call quote,$@)
+       $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA 'metadata' --stringparam BUILDTIME $$($(DATE) -u '+%Y-%m-%dT%H:%M:%SZ') --stringparam IDENTIFIER $(call quote,$(call localuri,$(call uncompiled,$@)))$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) >|$(call quote,$@)
 
 # Create the final files from the compiled results (or error in the case of recursive ones).
 $(call built,$(compilablefiles)) : $(BUILDDIR)/public/% : $(BUILDDIR)/results/%
 
 # Create the final files from the compiled results (or error in the case of recursive ones).
 $(call built,$(compilablefiles)) : $(BUILDDIR)/public/% : $(BUILDDIR)/results/%
index 4ce99945acbd4c0fb4fd0ba1689ad0ae4b983b90..37cc7f7cd7ff8b5f00284bde7c735ce46629bdb6 100644 (file)
@@ -618,11 +618,6 @@ The following params are made available globally in parsers and
 - **`THISREV`:**
   The value of the `THISREV` variable (if present).
 
 - **`THISREV`:**
   The value of the `THISREV` variable (if present).
 
-The following params are only available in transforms :⁠—
-
-- **`PATH`:**
-  The path of the output file (within `DESTDIR`).
-
 ## Output Wrapping
 
 Provided at least one toplevel result element belongs to the H·T·M·L
 ## Output Wrapping
 
 Provided at least one toplevel result element belongs to the H·T·M·L
index 5098a2cdd38b92d5cc61f587e680cf3a009ad9ee..e169fa7495a63c64340845b06a51594f1d99a71a 100644 (file)
@@ -17,7 +17,6 @@ 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"
 ]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
-       xmlns:dct="http://purl.org/dc/terms/"
        xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslstr="http://exslt.org/strings"
        xmlns:catalog="urn:oasis:names:tc:entity:xmlns:xml:catalog"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslstr="http://exslt.org/strings"
@@ -29,12 +28,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns:xslt="http://www.w3.org/1999/XSL/TransformAlias"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns:xslt="http://www.w3.org/1999/XSL/TransformAlias"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
+       xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"
        exclude-result-prefixes="catalog"
        version="1.0"
 >
        <include href="literally.xslt"/>
        <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
        <param name="METADATA" select="'about:blank'"/>
        exclude-result-prefixes="catalog"
        version="1.0"
 >
        <include href="literally.xslt"/>
        <namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
        <param name="METADATA" select="'about:blank'"/>
+       <variable name="builddir" select="document($METADATA)//书社vocab:BuildDirectory/@nfo:fileUrl"/>
        <template match="/">
                <variable name="ids">
                        <for-each select="//catalog:uri[@name]">
        <template match="/">
                <variable name="ids">
                        <for-each select="//catalog:uri[@name]">
@@ -53,7 +54,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                <xslt:transform exclude-result-prefixes="nie nfo" extension-element-prefixes="exsl exslstr" version="1.0">
                        <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
                        <xslt:param name="IDENTIFIER" select="false()"/>
                <xslt:transform exclude-result-prefixes="nie nfo" extension-element-prefixes="exsl exslstr" version="1.0">
                        <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
                        <xslt:param name="IDENTIFIER" select="false()"/>
-                       <xslt:param name="PATH" select="'/unknown'"/>
                        <xslt:param name="SRCREV" select="false()"/>
                        <xslt:param name="THISREV" select="false()"/>
                        <xslt:variable name="书社:source" select="/"/>
                        <xslt:param name="SRCREV" select="false()"/>
                        <xslt:param name="THISREV" select="false()"/>
                        <xslt:variable name="书社:source" select="/"/>
@@ -71,19 +71,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <xslt:apply-templates select="$书社:expansion/node()"/>
                        </xslt:variable>
                        <xslt:variable name="书社:result" select="exsl:node-set($书社:result-fragment)"/>
                                <xslt:apply-templates select="$书社:expansion/node()"/>
                        </xslt:variable>
                        <xslt:variable name="书社:result" select="exsl:node-set($书社:result-fragment)"/>
-                       <xslt:variable name="书社:destination">
-                               <xslt:choose>
-                                       <xslt:when test="string($书社:source/@书社:destination)!=''">
-                                               <xslt:value-of select="$书社:source/@书社:destination"/>
-                                       </xslt:when>
-                                       <xslt:when test="starts-with($PATH, '/')">
-                                               <xslt:value-of select="substring-after($PATH, '/')"/>
-                                       </xslt:when>
-                                       <xslt:otherwise>
-                                               <xslt:value-of select="$PATH"/>
-                                       </xslt:otherwise>
-                               </xslt:choose>
-                       </xslt:variable>
+                       <xslt:variable name="书社:destination" select="string($书社:about//*[@rdf:about=$IDENTIFIER]/@书社vocab:destination)"/>
                        <for-each select="//catalog:uri">
                                <xslt:include href="{@uri}">
                                        <attribute name="书社:id">
                        <for-each select="//catalog:uri">
                                <xslt:include href="{@uri}">
                                        <attribute name="书社:id">
@@ -359,9 +347,23 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        </xslt:template>
                        <xslt:template match="书社:link[@xlink:show='embed']" mode="书社:expand" priority="1">
                                <xslt:variable name="identifier" select="string(@xlink:href)"/>
                        </xslt:template>
                        <xslt:template match="书社:link[@xlink:show='embed']" mode="书社:expand" priority="1">
                                <xslt:variable name="identifier" select="string(@xlink:href)"/>
-                               <xslt:variable name="uri" select="document($METADATA)//*[@rdf:about=$identifier]/dct:hasFormat/*[nie:interpretedAs/*[@nie:mimeType='application/xml']]/@nfo:fileUrl[1]"/>
+                               <xslt:variable name="included" select="$书社:about//*[@rdf:about=$identifier]"/>
                                <xslt:choose>
                                <xslt:choose>
-                                       <xslt:when test="$uri">
+                                       <xslt:when test="$included">
+                                               <xslt:variable name="uri">
+                                                       <xslt:text>
+                                                               <value-of select="$builddir"/>
+                                                       </xslt:text>
+                                                       <xslt:choose>
+                                                               <xslt:when test="$included/self::书社vocab:SourceFile">
+                                                                       <xslt:text>/sources/</xslt:text>
+                                                               </xslt:when>
+                                                               <xslt:when test="$included/self::书社vocab:IncludeFile">
+                                                                       <xslt:text>/includes/</xslt:text>
+                                                               </xslt:when>
+                                                       </xslt:choose>
+                                                       <xslt:value-of select="$included/@书社vocab:path"/>
+                                               </xslt:variable>
                                                <xslt:variable name="expanded">
                                                        <xslt:apply-templates select="document($uri)" mode="书社:expand">
                                                                <xslt:with-param name="identifier" select="$identifier"/>
                                                <xslt:variable name="expanded">
                                                        <xslt:apply-templates select="document($uri)" mode="书社:expand">
                                                                <xslt:with-param name="identifier" select="$identifier"/>
index e75fe23a28a713b8575dff26c48f2f2e5dc75160..e35e2c831b1ad21dce157e4039a0ae3b52ffc198 100644 (file)
@@ -13,7 +13,6 @@ 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"
 -->
 <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: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#"
@@ -24,8 +23,8 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        extension-element-prefixes="exsl"
        version="1.0"
 >
        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)]"/>
+       <variable name="builddir" select="//书社vocab:BuildDirectory/@nfo:fileUrl"/>
+       <variable name="files" select="//书社vocab:SourceFile|//书社vocab:IncludeFile"/>
        <template name="书社:process-dependencies">
                <param name="processed"/>
                <param name="unprocessed"/>
        <template name="书社:process-dependencies">
                <param name="processed"/>
                <param name="unprocessed"/>
@@ -66,7 +65,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                        </when>
                                                </choose>
                                        </variable>
                                                        </when>
                                                </choose>
                                        </variable>
-                                       <for-each select="document(concat($builddir, $subdir, @nfo:fileName), .)//书社:link[@xlink:show='embed']">
+                                       <for-each select="document(concat($builddir, $subdir, @书社vocab:path), .)//书社:link[@xlink:show='embed']">
                                                <if test="exsl:node-set($old)/书社:dependency-root[string()=string(current()/@xlink:href)]">
                                                        <书社:recursive-dependency>
                                                                <value-of select="$parent"/>
                                                <if test="exsl:node-set($old)/书社:dependency-root[string()=string(current()/@xlink:href)]">
                                                        <书社:recursive-dependency>
                                                                <value-of select="$parent"/>
@@ -97,34 +96,51 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        </otherwise>
                </choose>
        </template>
                        </otherwise>
                </choose>
        </template>
-       <template match="rdf:RDF/nfo:LocalFileDataObject[not(nie:interpretedAs/nfo:Folder or nie:interpretedAs/nfo:PlainTextDocument)]" priority="1">
+       <template match="//书社vocab:SourceFile[not(nie:interpretedAs/nfo:PlainTextDocument)]" priority="1">
                <copy>
                <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>
+                       <apply-templates select="@*"/>
+                       <attribute name="书社vocab:destination">
+                               <value-of select="@书社vocab:path"/>
+                       </attribute>
+                       <apply-templates select="node()"/>
                </copy>
        </template>
                </copy>
        </template>
-       <template match="rdf:RDF/nfo:LocalFileDataObject[nie:interpretedAs/nfo:PlainTextDocument]" priority="1">
-               <variable name="parsed" select="document(concat($builddir, '/sources/', @nfo:fileName), .)"/>
+       <template match="//书社vocab:SourceFile[nie:interpretedAs/nfo:PlainTextDocument]" priority="1">
+               <variable name="parsed" select="document(concat($builddir, '/sources/', @书社vocab:path), .)"/>
                <variable name="destination-delim" select="concat('/', $parsed/*/@书社:destination, '/')"/>
                <variable name="destination">
                        <choose>
                <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>
                                <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=')"/>
+                                       <value-of select="@书社vocab:path"/>
                                </otherwise>
                        </choose>
                </variable>
                <variable name="dependencies-fragment">
                        <apply-templates select="." mode="书社:dependencies"/>
                </variable>
                                </otherwise>
                        </choose>
                </variable>
                <variable name="dependencies-fragment">
                        <apply-templates select="." mode="书社:dependencies"/>
                </variable>
-               <variable name="dependencies" select="exsl:node-set($dependencies)"/>
+               <variable name="dependencies" select="exsl:node-set($dependencies-fragment)"/>
+               <copy>
+                       <apply-templates select="@*"/>
+                       <attribute name="书社vocab:destination">
+                               <value-of select="$destination"/>
+                       </attribute>
+                       <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>
+               </copy>
+       </template>
+       <template match="//书社vocab:IncludeFile[nie:interpretedAs/nfo:PlainTextDocument]" priority="1">
+               <variable name="dependencies-fragment">
+                       <apply-templates select="." mode="书社:dependencies"/>
+               </variable>
+               <variable name="dependencies" select="exsl:node-set($dependencies-fragment)"/>
                <copy>
                        <apply-templates select="@*|node()"/>
                        <for-each select="$dependencies/书社:dependency">
                <copy>
                        <apply-templates select="@*|node()"/>
                        <for-each select="$dependencies/书社:dependency">
@@ -133,12 +149,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        <for-each select="$dependencies/书社:recursive-dependency">
                                <书社vocab:hasRecursiveDependencyOn 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>
        </template>
        <template match="@*|node()">
@@ -146,7 +156,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        <apply-templates select="@*|node()"/>
                </copy>
        </template>
                        <apply-templates select="@*|node()"/>
                </copy>
        </template>
-       <template match="nfo:LocalFileDataObject" mode="书社:dependencies">
+       <template match="书社vocab:SourceFile|书社vocab:IncludeFile" mode="书社:dependencies">
                <if test="nie:interpretedAs/nfo:PlainTextDocument">
                        <call-template name="书社:process-dependencies">
                                <with-param name="unprocessed">
                <if test="nie:interpretedAs/nfo:PlainTextDocument">
                        <call-template name="书社:process-dependencies">
                                <with-param name="unprocessed">
index 7bbd4facd5dcc88065aa399b89780f6e96afa000..5f71053866ddd4fb147cbc60e65e9793fdacb9f6 100644 (file)
@@ -20,7 +20,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        version="1.0"
 >
        <template match="/">
        version="1.0"
 >
        <template match="/">
-               <for-each select="rdf:RDF/nfo:LocalFileDataObject[nie:interpretedAs/nfo:PlainTextDocument]">
+               <for-each select="rdf:RDF/*[nie:interpretedAs/nfo:PlainTextDocument]">
                        <value-of select="@rdf:about"/>
                        <text>&#xA;</text>
                        <for-each select="书社vocab:hasRecursiveDependencyOn/@rdf:resource">
                        <value-of select="@rdf:about"/>
                        <text>&#xA;</text>
                        <for-each select="书社vocab:hasRecursiveDependencyOn/@rdf:resource">
index e1fe1cd6a19725a04dec4f81aa0462081ca01b4e..e82aa0b36cdd1e6857a7593853fcf56e40e0eed7 100644 (file)
@@ -13,16 +13,15 @@ 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"
 -->
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
-       xmlns:dct="http://purl.org/dc/terms/"
-       xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+       xmlns:书社vocab="urn:fdc:ladys.computer:20231231:Shu1She4:vocab:"
        version="1.0"
 >
        <template match="/">
        version="1.0"
 >
        <template match="/">
-               <for-each select="/rdf:RDF/nfo:LocalFileDataObject[starts-with(@rdf:about, 'about:shushe?source=')]">
+               <for-each select="//书社vocab:SourceFile">
                        <value-of select="@rdf:about"/>
                        <text>|</text>
                        <value-of select="@rdf:about"/>
                        <text>|</text>
-                       <value-of select="dct:hasFormat/nfo:LocalFileDataObject[@dct:creator='urn:fdc:ladys.computer:20231231:Shu1She4']/@nfo:fileName"/>
+                       <value-of select="@书社vocab:destination"/>
                        <text>&#xA;</text>
                </for-each>
        </template>
                        <text>&#xA;</text>
                </for-each>
        </template>
This page took 0.04168 seconds and 4 git commands to generate.