diff --git a/.lein-deps-sum b/.lein-deps-sum index 892895e..c7899d8 100644 --- a/.lein-deps-sum +++ b/.lein-deps-sum @@ -1 +1 @@ -84df5127361c4d9fcfd926f1ba75a713b8892766 \ No newline at end of file +d50ad254b6e356457e34849f229a9602479f8088 \ No newline at end of file diff --git a/project.clj b/project.clj index 2be6b74..791696a 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject edu.unl/abbot "0.3.1" +(defproject edu.unl/abbot "0.3.2" :description "Abbot: A Conversion Tool for Text Interoperability" :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/clojure-contrib "1.2.0"] diff --git a/resources/xslt/metaStylesheetForRNGschemas.xsl b/resources/xslt/metaStylesheetForRNGschemas.xsl index 613227f..ee252f7 100644 --- a/resources/xslt/metaStylesheetForRNGschemas.xsl +++ b/resources/xslt/metaStylesheetForRNGschemas.xsl @@ -257,8 +257,8 @@ XSLT processor used to create this stylesheet: - templateID - + - + desc - + - + listOfAttributes - + - + - + - + - + thisNodeAfterTransformation - + @@ -335,7 +335,7 @@ - + @@ -346,7 +346,7 @@ and descendant::attribute/@choice='change' and descendant::content/@use[starts-with(.,'@')] and descendant::content/@choice='text'"> - + @@ -355,7 +355,7 @@ - + @@ -371,9 +371,9 @@ - + - + @@ -381,7 +381,7 @@ /> - + @@ -390,7 +390,7 @@ - --> + diff --git a/src/edu/unl/abbot/cli.clj b/src/edu/unl/abbot/cli.clj index a638782..beda3d3 100644 --- a/src/edu/unl/abbot/cli.clj +++ b/src/edu/unl/abbot/cli.clj @@ -36,4 +36,4 @@ (c/optional ["-s" "--single" "Run in single-threaded mode" :default false]) (c/optional ["-i" "--inputdir" "Input directory path" :default (str abbot-home "/input")]) (c/optional ["-o" "--outputdir" "Output directory path" :default (str abbot-home "/output/")]))] - (time (convert-files opts)))) + (convert-files opts))) diff --git a/src/edu/unl/abbot/core.clj b/src/edu/unl/abbot/core.clj index a4beec1..dab7080 100644 --- a/src/edu/unl/abbot/core.clj +++ b/src/edu/unl/abbot/core.clj @@ -42,10 +42,7 @@ (defn convert-files [arg-map] "Apply the conversion stylesheet to the input files" - (let [output-dir (:outputdir arg-map) - schema (:schema arg-map) - config (:config arg-map) - conversion-stylesheet (stylesheet schema config)] + (let [output-dir (:outputdir arg-map)] (if (:single arg-map) - (doall (map #(spit (str output-dir (.getName %)) (convert conversion-stylesheet %)) (input-files (:inputdir arg-map)))) - (doall (pmap #(spit (str output-dir (.getName %)) (convert conversion-stylesheet %)) (input-files (:inputdir arg-map))))))) + (doall (map #(spit (str output-dir (.getName %)) (convert %)) (input-files (:inputdir arg-map)))) + (doall (pmap #(spit (str output-dir (.getName %)) (convert %)) (input-files (:inputdir arg-map))))))) diff --git a/src/edu/unl/abbot/stylesheets.clj b/src/edu/unl/abbot/stylesheets.clj index 38a8d10..5e6f39b 100644 --- a/src/edu/unl/abbot/stylesheets.clj +++ b/src/edu/unl/abbot/stylesheets.clj @@ -21,11 +21,7 @@ (ns edu.unl.abbot.stylesheets (:use edu.unl.abbot.utils) - (:require [saxon :as sax]) - (:require [clojure.xml :as xml]) - (:require [clojure.zip :as zip]) - (:require [clojure.contrib.zip-filter.xml :as zf]) - (:require [clojure.contrib.prxml :as px])) + (:require [saxon :as sax])) ;; Creates the "conversion stylesheet" (the stylesheet that does the ;; actual conversion) from the "meta-stylesheet" @@ -33,14 +29,15 @@ ;; Templates from abbot_config.xml are read into the meta-stylesheet ;; at runtime (by the meta-stylesheet itself). -(defn stylesheet [schema config] - (let [meta-url "http://abbot.unl.edu/metaStylesheetForRNGschemas.xsl" - rng-file (sax/compile-xml (slurp schema)) - config-file (xml/parse config) - meta-file (xml/parse meta-url)] - (px/prxml meta-file) - (sax/compile-xslt (sax/compile-xslt (px/prxml (with-out-str meta-file))) rng-file))) +; (def foo (assoc-in stable [:content] (concat (get-in stable [:content]) (get-in add [:content])))) -(defn convert [conversion-stylesheet xml-file] +(def conversion-stylesheet + (let [schema-url "http://abbot.unl.edu/tei-xl.rng" + rng-file (sax/compile-xml (java.net.URL. schema-url)) + meta-url "http://abbot.unl.edu/metaStylesheetForRNGschemas.xsl" + meta-stylesheet (sax/compile-xslt (java.net.URL. meta-url))] + (sax/compile-xslt (meta-stylesheet rng-file)))) + +(defn convert [xml-file] (let [xmlfile (sax/compile-xml xml-file)] (conversion-stylesheet xmlfile)))