Fixes to allow parsing, and XML export, of embedded template calls

Change-Id: I8cbfdfae854f4a4dbabe6d0b8703adc8e7ca3cb1