Serialization and deserialization follow the scheme below:
· During serialization, the literal elements of templates are passed to the target XML document unchanged; the ST commands specified in between are executed.
· During deserialization, the source XML document is treated as an inbound stream and compared to the template element by element. Elements (or attributes or texts) with the same name of the inbound stream are consumed if they are positioned in the ST program at the same place or if a command is positioned there that can process the element. After the successful comparison or consumption of the element, the comparison of the subsequent element starts.
When you define a simple transformation, pay attention to whether the serialization and deserialization are symmetric or not:
Symmetry of Serialization and Deserialization