]> Lady’s Gitweb - Shushe/blobdiff - lib/expandmetadata.xslt
Simplify metadata using new 书社vocab terms
[Shushe] / lib / expandmetadata.xslt
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"
-       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#"
@@ -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"
 >
-       <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"/>
@@ -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>
-                                       <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"/>
@@ -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>
-       <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>
-                       <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>
-       <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>
-                               <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=')"/>
+                                       <value-of select="@书社vocab:path"/>
                                </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">
@@ -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>
-                       <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()">
@@ -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>
-       <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">
This page took 0.026366 seconds and 4 git commands to generate.