]> Lady’s Gitweb - Shushe/blobdiff - lib/metadata2dependencies.xslt
Generate destinations and dependencies as metadata
[Shushe] / lib / metadata2dependencies.xslt
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>
This page took 0.025332 seconds and 4 git commands to generate.