The current interpreter MtSgmlQL accepts two formats as input and output: a normalized version of SGML, nSGML, and (a subset of) the output of the sgmls and nsgmls parsers, sgmls. Default format is nSGML (see I/O formats in the **MtSgmlQL interpreter documentation**).
Input must consist of a valid SGML document. Output can consist of the result of any query, whether or not it is a valid SGML document. Both input and output can be from standard input/output or from files.
Element identifiers and attributes names are folded to uppercase for internal representation. Attribute values are read as strings and retain their original case.
Output follows SGML rules. Numbers, booleans, names and strings are output as their text value, without surrounding quotes, unless they are the value of an attribute-value pair:
Examples
"Hello!";Hello!N=4;N="4"Lists and sets are output without brackets or braces, and without internal delimiters, apart from attribute-value sets, whose members are separated by spaces:
Examples
[1, 2, 3]; 123{1, 2, 3}; 123{A=1, B=2, C=3}; A="1" B="2" C="3"Elements whose identifier is a hidden name are written without surrounding tags. Attributes with hidden names are not output.
Example
%<A #PRIVATE="XXX">Hello!</A>%; <A> Hello! </A>Finally, in nSGML format, a carriage return is output after each opening tag, and before each closing tag. No carriage return is output between a closing tag and a subsequent opening tag. Although this last condition does not lead to the most readable format, it is necessary because of SGML's treatment of "record boundaries" in order not to introduce spurious carriage returns in the data.
Example
select element TAG content: $i from $i in [1, 2, 3] ;<TAG> 1 </TAG><TAG> 2 </TAG><TAG> 3 </TAG>