if i were to start today, i'd either generate libreoffice's xml format (you can exec commandline tools to generate pdf);
I tried this two years ago and ran into some problems. As I remember:
OpenOffice (of which Libre Office is a fork) had a weird client-server model for command-line use. It was a pain to set up initially, and the version of OpenOffice that came with Debian on our servers didn't work at all. The best way to check if a document would finish being printed as a PDF was to poll the filesystem. It took a long time to generate the PDFs, and what's worse is that this time varied widely with no apparent causes. The whole process was unreliable.
The templating itself was tricky. As you mentioned the node order matters, but also there were all sorts of undocumented dependencies between nodes (I was templating spreadsheets) and how node attributes were used.
Maybe things have improved by now, but if I had to do the same thing again I would not rely on Libre Office. There's too much bloat to deal with on both the development and system administration sides.
The big draw with Libre Office was that you can let business users easily customize the templates. A friend of mine is doing a SaaS web app in Common Lisp, generating documents via LaTeX, and is making a small web app that lets users customize the template layout. IMO this is simple enough to do that it's the approach I would use today (using CL-PDF or maybe cl-typesetting directly instead of going through LaTeX).
Vladimir