First, we should switch to Saxon 9.8 so we can use the wonderful xml-to-json functionality, avoiding all the nasty text escaping stuff. Second, in the serializedXhtml mode, we should output real elements and handle many more of the ones that can now appear in the place desc, then output the results of that, escaping it in a single operation. Then it'll be much easier to add support for many more TEI elements.
First, we should switch to Saxon 9.8 so we can use the wonderful xml-to-json functionality, avoiding all the nasty text escaping stuff. Second, in the serializedXhtml mode, we should output real elements and handle many more of the ones that can now appear in the place desc, then output the results of that, escaping it in a single operation. Then it'll be much easier to add support for many more TEI elements.