Как конвертировать xml в csv в функциональном стиле?
xandox хотелось примерно такого(ns su.gornostaev.rstatfr2csv
  (:use [clojure.xml :only (parse)])
  (:use [clojure.string :only [index-of join split]])
  (:use [clojure.java.io])
  (:import java.io.File))

(defn parse-cmd
  [args]
  (when-let [file-name (first args)]
    file-name))

(defn parse-file
  [file-name]
  (if (nil? file-name) nil (parse (File. file-name))))

(defn format-datetime
  [dt]
  (let [[date time] (split dt #"\s")]
    (str (join "." (reverse (split date #"\."))) " " (subs time 0 (index-of time \:)) ":00")))

(defn merge-counters
  [counters]
  (map
    (fn [item]
      (let [[k & v] item]
      (assoc (reduce (fn [acc val] (merge-with + acc val)) (first v)) :dt k)))
    (reduce
      (fn [acc val] 
        (let [{:keys [dt in out]} val]
        (update-in acc [dt] (fnil #(conj % {:in in :out out}) []))))
      {} counters)))

(defn parse-counters
  [sensor]
  (map
    (fn [counter]
      {:dt (format-datetime (:datetime (:attrs counter))) 
       :in (read-string (:realin (:attrs counter))) 
       :out (read-string (:realout (:attrs counter)))})
    sensor))

(defn parse-sensors
  [shop]
  (map
    (fn [sensor]
      {:name (:name (:attrs sensor)) :counters (merge-counters (parse-counters (:content sensor)))})
    shop))

(defn parse-shops
  [dom]
  (map
    (fn [shop]
      {:name (:name (:attrs shop)) :sensors (seq (parse-sensors (:content shop)))})
    dom))

(defn parse-doc
  [doc]
  (parse-shops
    (->> 
      doc
      :content
      first
      :content)))

(defn save-csv
  [data]
  (with-open [w (writer (file "output.csv"))]
    (doseq [shop data]
      (doseq [sensor (:sensors shop)]
        (doseq [counter (:counters sensor)]
          (.write w (str (join "\t" (concat [(:name shop) (:name sensor)] (vals (into (sorted-map) counter)))) "\n")))))))

(save-csv (parse-doc (parse-file (parse-cmd *command-line-args*))))
preg_match... 3 штуки, потом по результатам - циклы с перебором результатов.
Но лучше взять готовый парсер, к примеру SimpleXML.