Pattern 
When conditional transformations are deserialized, the fact whether the template content is what is called a pattern is used as a criterion for the assessment. A pattern contains one or more constructs that are used as markers. The most common form of a marker is a literal XML element: if the content of the condition consists of exactly one XML element, then the condition has exactly one positive result if an XML element with this name follows at the current position in the XML input stream.
Marker constructs are:
Literal XML element with or without content
Non-literal attribute with content
Non-empty literal text
Explict empty template content
Each of these constructs can be compared with the input stream in an obvious way.
In general, a pattern can contain several markers. For example, sequence
Syntax
<tt:cond>
<X> ... </X>
</tt:cond>
<Y> ... </Y>
is also a pattern; it contains markers <X> and <Y>. A condition with this pattern is determined positively by element X as well as by element Y in the input stream (in the second case, condition is determined negatively with X).
The quantity of the marker constructs M(c) contained in template content c is defined recursively below. Template content c is a pattern if M(c) is not empty. In summary, M(c) consists of the markers that can be used to positively determine pattern c, where conditions in an initial part of c can also be determined negatively.
M(c) = {c} for marker c. This means that each marker is a (primitive) pattern; the marker quantity for this pattern consists of the marker itself.
Some constructs propagate markers externally:
M(tt:deserialize) = M(tt:ref) = M(c) for the content c of the construct.
M(tt:apply) = M(c) for the body c of the called template.
M(tt:loop) = M(c) for the loop body c.
Conditional transformations also propagate markers; with case distinctions and groupings, the union is made in all cases:
M(tt:[d-]cond) = M(c) for the condition body c.
M(tt:group) = M(tt:switch) = M(c1) U ... U M(cn) for all cases ci = tt:[d-]cond
For all other instructions c, M(c) is empty.
For c ic2 ... sequences of template content, the following applies:
M(c ic2 ...) = M(c1) U M(c2 ...) , if c1 is a Pre-Pattern = M(c1) , otherwise
Template content is a pre-pattern if its deserialization is possible without the use of content from the input stream. In detail:
All constructs with an empty deserialization are pre-patterns. These are tt:s-cond, tt:assign, tt:clear, tt:serialize, tt:write, and compositions of these with tt:cond-var, tt:switch-var, and tt:apply.
tt:[d-]cond is a pre-pattern if the condition body is a pattern. (If the pattern cannot be compared, the condition is determined negatively and is skipped.)
tt:deserialize, tt:ref, and tt:apply propagate the pre-pattern property.
The content of the following tt:cond is a pattern with marker elements {f1, f2, f3} (but not fx).
Syntax
<tt:cond s-check="not-initial(F3) and initial(F6)">
<tt:clear ref="F3"/>
<tt:cond check="not-initial(F1) or not-initial(F2)">
<tt:cond check="not-initial(F1)">
<tt:clear ref="F1"/>
<tt:serialize>
<f1 a="v" tt:value-ref="F1"/>
</tt:serialize>
<tt:deserialize>
<f1 tt:value-ref="F1"/>
</tt:deserialize>
</tt:cond>
<f2 tt:value-ref="F2"/>
</tt:cond>
<f3 tt:value-ref="F3"/>
<fx> ... </fx>
</tt:cond>