Skip to content

Instantly share code, notes, and snippets.

@eerohele
Created November 20, 2014 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eerohele/5d8c75697cf8b7f253c5 to your computer and use it in GitHub Desktop.
Save eerohele/5d8c75697cf8b7f253c5 to your computer and use it in GitHub Desktop.
An example of parsing a DITA file with clojure-saxon
(ns dita
(:require [saxon :as xml])
(:import (net.sf.saxon.trans XmlCatalogResolver)))
(def xmldoc (slurp "/path/to/ditamap"))
(. net.sf.saxon.trans.XmlCatalogResolver
(setCatalog "/path/to/dita-ot/src/main/catalog-dita.xml" (.getUnderlyingConfiguration xml/proc) true))
(def xdmnode (xml/compile-xml xmldoc))
(def hrefs (xml/query "//*[contains(@class, ' map/topicref ')]/@href" xdmnode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment