     (-> out .getWriter .toString)))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; API
-
-(defn tango-xml-encode [xml-str]
-  (cstr/escape xml-str {
-                        \Ö "&#214;"
-                        \ö "&#246;"
-                        \ä "&#228;"
-                        \å "&#229;"
-                        \é "&#233;"
-                        })
-  )
-
-(tango-xml-encode "<Couple Seq=10\" Number=\"1090\" Name=\"Ebba Hellsten - Emmy Rapp\" Club=\"ND/ÖDT\" License=\"\"/>")
-
 (defn export-results [activities-with-result export-path]
   (log/info (str "Export Results to " export-path " with " activities-with-result))
   (let [in-xml (get-xml-from-file export-path)
         class-results (map activity-result->class-result activities-with-result)
-        ;out-xml (add-results-to-dp-xml in-xml (first class-results))
-        out-xml (reduce add-results-to-dp-xml in-xml class-results)
-        ]
-    (with-open [w (java.io.FileWriter. "bar.xml")]
-      (xml/emit out-xml w)) 
-    ))
+        out-xml (reduce add-results-to-dp-xml in-xml class-results)]
+    (make-copy-with-timestamp export-path)
+    (spit export-path (ppxml (xml/emit-str out-xml)))))
+
 (map activity-result->class-result activities-with-result)
 (activity-result->class-result activities-with-result)
 
-(defn smoke-test [] (export-results activities-with-result "dp.xml"))
+(defn smoke-test [] (export-results (activities-with-result) "dp.xml"))
 
 (smoke-test)
 

            :result-array (result-facts->result-array (:result/_activity activity-result))
            }})


(get-marks result-facts)
(get-dancers result-facts)
(get-results-for-dancer result-facts 141)
(apply hash-set [:a :b :b :c])
(activity-result->class-result activity-result)
activity-result
;; Provides useful Timbre aliases in this ns
(log/refer-timbre)


        out-xml (add-results-to-dp-xml in-xml (first class-results))]
    (spit "export5.xml" (xml/emit-str out-xml))))

;; TODO - should be the callers responsibillity to provide correct format
(defn- transform-result [activities-with-result]
  
