Now, I'd got the data into the document, JOpendocument addon to LibreOffice writer were missing. You might find a link to it at the very end of the JOpendocument website.
Furthermore what's template here, is not what LibreOffice treat as a template, test.odt is a writer file, and not a template. Renaming it to .ott do not make it an LibreOffice template. template.createDocument creates a ODSingleXMLDocument, yes, but note that this function do not create an document from a template. If template is a template, it will create a template, or if template is a writer document, it will create a writer document. I'd have done some research for if possible to generate a doc from a template, like LibreOffice do, but that seems like it is not straight forward, JOpendocument do'nt support it by now. Now, I'd need to determine the name of the resulting doc, but if that's not important, it's just to load an template into template object, do whatever you like, save it to an temporary file, and open int in LibreOffice. The user may then select a filename for it. Until JOpenDocument are supporting creation of a document from an template, I'd just make an doc from the actual template, and that will do fine. I'd has to remember to make a new one if the template is altered, however. Happy coding!