12.4.3 Sosofos
An object of type sosofo is a specification of a sequence of flow objects to be added to the flow object tree.
The expression language never operates on flow objects directly; it only operates on their specifications using the sosofo data type.
An implementation will use the information in a sosofo to construct portions of the flow object tree when a sosofo is returned by a construct-expression in a construction-rule that has been applied to some node in a source grove.
Each flow object specified by a sosofo may be labeled with a symbol. A sosofo whose members are all unlabeled is called an unlabeled sosofo.

NOTE 43

A flow object is labeled by specifying a label: argument in a make-expression.
(sosofo? obj)
Returns #t if obj is a sosofo, and otherwise returns #f.
[175] make-expression = (make flow-object-class-name keyword-argument-list content-expression*)
[176] content-expression = expression
The result of evaluating a make-expression is a sosofo (the result sosofo) whose first specified member is a flow object of the class named by the flow-object-class-name. This flow object is called the constructed flow object. Each content-expression shall return an object of type sosofo. The sosofos returned by the content-expressions are concatenated to form the content sosofo. No content-expressions shall be specified if the flow-object-class-name is of an atomic flow object class. If the flow-object-class-name is not of an atomic flow object class and the make-expression contains no content-expressions, then a content-expression with the effect of (process-children) shall be used.
Each make-expression has a content map that maps labels to ports.  Each flow object specified in the content sosofo is considered in turn.  If it is unlabeled, it is appended to the stream attached to the principal port of the constructed flow object, if the constructed flow object has a principal port, otherwise this shall be an error.  If it is labeled, and the label is one that is mapped by the content map, then the flow object is appended to the stream attached to the port of the flow object to which that label is mapped.  Otherwise, the flow object is appended to the result sosofo; these flow objects are after the constructed flow object in the result sosofo.
A keyword shall be treated as part of the keyword-argument-list rather than as a content-expression. If the same keyword occurs more than once in the keyword-argument-list, it shall not be an error, but all except the first occurrence shall be ignored. The following keywords are allowed in the keyword-argument-list:

•  A keyword that is the name of a characteristic and specifies the value of that characteristic for the flow object (unless it is an inherited characteristic that is overridden) as described in section 12.4.6, Characteristic Specification. If the characteristic is not inherited, then the characteristic shall be one that is applicable to the constructed flow object.

•  A keyword force!c: where c is the name of an inherited characteristic that specifies the value of that characteristic for the flow object and prevents overriding of that value as described in section 12.4.6, Characteristic Specification.

•  A keyword that is the name of a reference value type and specifies that the constructed flow object has a reference value of that type with the specified value.

•  use: specifying a style to be used for the constructed flow object as described in section 12.4.6, Characteristic Specification. The value shall be a style object or #f indicating that no style shall be used.

•  content-map: specifying the content map for the make-expression. The value shall be a list of lists of two objects, where the first object is a symbol that specifies a label and the second object is either a symbol specifying the name of a port or #f specifying the principal port. No label shall occur more than once in a content map.

If the content-map: argument is not specified, then a content map shall be used that for each non-principal port of the flow object contains a list of two symbols both equal to the name of the port.

•  label: specifying the label for the constructed flow object in the result sosofo.  This argument shall be a symbol.
[177] flow-object-class-name = identifier
Any identifier that is the name of a flow object class is a flow-object-class-name.
[178] application-flow-object-class-declaration = (declare-flow-object-class identifier string)
This declares identifier to be a flow-object-class-name for a class with a public identifier specified by string.
[179] with-mode-expression = (with-mode mode-specification expression)
[180] mode-specification = mode-name | #f
A with-mode-expression evaluates expression with the processing mode specified by mode-specification. A mode-specification of #f indicates the initial unnamed processing mode. The mode-name in mode-specification shall have been specified in a mode-construction-rule-group.
(empty-sosofo)
Returns an empty sosofo.
(literal string )
Returns a sosofo containing one flow object of class character for every char in string,  in the same order.  Each character flow object is constructed as if by evaluating a make-expression with character as the flow-object-class-name and a char: argument specifying the character.
(process-children)
Returns the sosofo that results from appending the sosofos that result from processing in order the children of the current node.  When the current node is of class sgml-document, the value of the document-element property is treated as being the children of the node.
(process-children-trim)
Returns the sosofo that results from appending the sosofos that result from processing in order the children of the current node after removing any leading and trailing sequence of nodes that have a char property with the input-whitespace property true.
(process-matching-children pattern )
Returns the sosofo that results from appending the sosofos that result from processing in order those children of the current node that match any of pattern, .  A pattern shall be an object that is allowed as the second argument to the match-element? procedure.  It is interpreted as it is by match-element?.
(process-first-descendant pattern )
Returns the sosofo that results from processing the first descendant in tree order of the current node that matches any of pattern, .  A pattern shall be an object that is allowed as the second argument to the match-element? procedure.  It is interpreted as it is by match-element?.
(process-element-with-id string)
Returns the sosofo that results from processing the element in the same grove as the current node whose unique identifier is string, if there is such an element, and otherwise returns an empty sosofo. This procedure requires the cross-reference feature.
(process-node-list ndlist)
Returns the sosofo that results from appending the sosofos that result from processing the members of the ndlist in order.  This requires the query feature.
(map-constructor procedure node-list)
For each node in node-list, procedure is evaluated with that node as a current node.   procedure shall be a procedure of no arguments and shall return a sosofo. map-constructor shall return the sosofo that results from concatenating the results of evaluating the procedure. This requires the query feature.
(sosofo-append sosofo )
Returns the sosofo that results from appending sosofo .
(sosofo-label sosofo symbol)
Returns a sosofo that results from labeling with symbol each member of sosofo that is currently unlabeled. A new sosofo is constructed; neither the sosofo nor its members are modified.
(sosofo-discard-labeled sosofo symbol)
Returns a sosofo that results from discarding from sosofo any flow object that is labeled with symbol.  A new sosofo is constructed; the sosofo is not modified.
(next-match)
(next-match style)
Returns the sosofo that results from applying the next most specific construction rule that matches the current node. If style is specified, then that style shall become the current overriding style for the evaluation of that construction rule.