I looked at some examples on how to transform XML on a node by node level and ended up looking at
https://gist.github.com/zentrope/728034.
I find this a very boiler plate heavy and rather object oriented way of doing this. I would prefer to have something more functional. For example, I can imagine that there is a function defined on scala.xml.Node called tmap that takes a f : ( Node ) => Seq[Node] and applies across the whole tree under the original node.
val n = <a><b>Text</b></a>
n.tmap
{ case Elem(ns, "a", attribs, scope, kids @ _*) =>
<features> |
| { features map { d => <feature id={d}/> } } |
| </features>
case other => other } |
Similar we could implement foldDF for a depth first fold and other functors.