Save the document identified by id. Using one of the FILE, PIPE, STRING keywords the user may choose to save the document to a file send it to a given command's input via a pipe or simply return its content as a string. If none of the keywords is used, it defaults to FILE. If saving to a PIPE, the expression argument must provide the coresponding command and all its parameters. If saving to a FILE, the expression argument may provide a filename; if omitted, it defaults to the original filename of the document. If saving to a STRING, the expression argument is ignored and may freely be omitted.
The output format is controlled using one of the XML, HTML, XInclude keywords (see below). If the format keyword is ommited, save it defaults to XML.
Note, that a document should be saved as HTML only if it actually is a HTML document. Note also, that the optional encoding parameter forces character conversion only; it is up to the user to declare the document encoding in the appropriate HTML <META> tag.
The XInclude keyword automatically implies XML format and can be used to force XSH to save all already expanded XInclude sections back to their original files while replacing them with <xi:include> tags in the main XML file. Moreover, all material included within <include> elements from the http://www.w3.org/2001/XInclude namespace is saved to separate files too according to the href attribute, leaving only empty <include> element in the root file. This feature may be used to split the document to new XInclude fragments.
The encoding keyword followed by a enc-string can be used to convert the document from its original encoding to a different encoding. In case of XML output, the <?xml?> declaration is changed accordingly. The new encoding is also set as the document encoding for the particular document.