declaring variables of any type:
Example: Set the variable $myfile to the filename "myfile-ces.sgml".
global $myfile = "http://aune.lpl.univ-aix.fr/projects/SgmlQL/examples/myfile-ces.sgml";
extracting sub-elements with a given generic identifier
Example: Find the (first, highest-level) DATE element in file $myfile.
first DATE within file $myfile;
<DATE> 16 July 1991 </DATE>
Example: Find all the DATE elements (within HEAD, DIV, and P, etc.) in file $myfile.
top DATE within file $myfile;
performing various tests and computations on objects
Example: Does a name matching "Jean" exist in file $myfile ?
exists $person in (top NAME within file $myfile) : text($person) match "Jean";
Example: Print the division head and the paragraph count for every division of file $myfile as a plain text.
select "-------------\n" . text(first HEAD within $div) . "\n" . count(top P within $div) . " Paragraph(s)\n\n" from $div in every DIV within file $myfile where not(empty(first HEAD within $div));
constructing new elements and SGML documents
Example: Find all NAME elements in file $myfile and create a new document NAMES containing these elements; put the title of file $myfile in an attribute "HREF" on NAMES.
document docdtd: "address.dtd" body: element NAMES attr: HREF = $myfile content: top NAME within file $myfile;