The DSI information is merged from the three sources in order of precedence:
The data you entered in the input fields of the Choose Document Template dialog.
When document is opened, Serna reads syntext-serna processing instructions in the document prolog (part of the document before the root element and DOCTYPE declaration). These PIs have name=value syntax, and override corresponding fields from a document template. Arbitrary number of name/value pairs can be specified in a single PI. For example, if you write
<?syntext-serna xml-stylesheet="my.xsl"?>
it will override <t:xml-stylesheet> field from the matched document template.
There is also special syntax name+=value, which concatenates the value to the end of a corresponding field of the document template. In the following example, we want to load an additional plugin MyPlugin, but we still want to load all plugins associated with this document type and therefore specified in the document template. Note the space before the plugin name - if you do not specify it, it will concatenate two plugin names (the last one from the document template and yours) and this will result in attempt to load a plugin with a wrong name:
<?syntext-serna load-plugins+=" MyPlugin"?>
A document template provides a convenient container for document metadata. Document templates are usually associated with document types. When you open a document, Serna tries to match an appropriate template, using the matching hints and rules specified in template itself. If no templates are matched, Serna provides a fallback default template, which contains the default stylesheet path and so on.
Document template matching is important because external metadata association also relies on the matched template name.
When you open a document from the recent files submenu only, Serna does not build DSI again - it remembers DSI state every time you save or close a document, and associates it with the recent files submenu entry.