Transforming an XML Tree with Scala Partial Functions