Has anybody written a tool to expand an XML template invocation?

I wonder, has anybody bothered to write a tool that would read an XML fragment
that contains a UseTemplate element and not much else, and then load all the
template definitions, and spit out what the XML fragment actually expands to?
Would make understanding how to create various XML things much easier… I
feel anybody who is getting into add-on development is going through the same
process, and manually diving into template after template to see what they
actually end up with;)

And when I start writing such a tool, of course I run into fundamental XML
syntax issues in the bundled template files. Like already in
Asobo/Generic/Helpers.xml. Line 39 is:


which obviously is incorrect XML syntax. The TEST_ID should be NEXT_ID.

OK, so I started on it, but yeah, it turns out to be much more complicated
than I had hoped, and require more effort than I can be bothered with at the
moment… One complication is that such a tool would need to include a RPN
interpreter to handle template parameter attributes when the Process attribute
has value “Int”, “Float”, or “String”. The contents of such a parameter is an
RPN snippet that needs to be evaluated at template expansion time, if I
understand correctly. Oh well, at least I learned a bit more about the magic
of templates. I still am not fully certain to what extent I want or need to
use the Asobo templates, though. One open question is whether they are even
supposed to be used random add-on aircraft developers like myself for
instruments and gauges that don’t really match any of the Asobo ones in
behaviour? Or are they developed only for use by Asobo’s own aircraft, without
any API stability guarantees? On one hand, many are documented to some extend
in the SDK, but on the other hand, some of them seem to contain implementation
details related to specific Asobo aircraft.

After some more hacking, I now have something that works, at least a bit,
here. Patches welcome.

… and now it is able to expand the whole DA62_interior.xml from the SDK DA62
sample aircraft. Hopefully it will be useful to somebody else, too.