When researching into related work for Krextor, I discovered this paper about XSDL (XML Semantics Definition Language). (Note that by XSDL the authors do not mean the new name of W3C XML Schema, as the latter has only been renamed recently.) XSDL is a language that allows for solving very similar problems as Krextor – extracting RDF in terms of some ontology from XML documents. I had always been looking for a nice declarative way of doing so, and there it is.