Relationships Transform Algorithm
The relationships transform takes the XML document from the Relationships part and converts it to another XML document.
The package implementer might create relationships XML that contains content from several namespaces, along with versioning instructions as defined in Part 5: “Markup Compatibility and Extensibility”. [O6.11]
The relationships transform algorithm is as follows:
Step 1: Process versioning instructions
The package implementer shall process the versioning instructions, considering that the only known namespace is the Relationships namespace.
The package implementer shall remove all ignorable content, ignoring preservation attributes.
The package implementer shall remove all versioning instructions.
Step 2: Sort and filter relationships
The package implementer shall remove all namespace declarations except the Relationships namespace declaration.
The package implementer shall remove the Relationships namespace prefix, if it is present.
The package implementer shall sort relationship elements by
@Idvalue in lexicographical order, considering@Idvalues as case-sensitive Unicode strings.The package implementer shall remove all
<Relationship>elements that do not have eitheran@Idvalue that matches any@SourceIdvalueor a@Typevalue that matches any@SourceTypevalue, among the@SourceIdand@SourceTypevalues specified in the transform definition. Producers and consumers shall compare values as case-sensitive Unicode strings. [M6.27] The resulting XML document holds all<Relationship>elements that either have an@Idvalue that matches a@SourceIdvalue or a@Typevalue that matches a@SourceTypevalue specified in the transform definition.
Step 3: Prepare for canonicalization
The package implementer shall remove all characters between the
<Relationships>start tag and the first<Relationship>start tag.The package implementer shall remove any contents of the
<Relationship>element.The package implementer shall remove all characters between the last
<Relationship>end tag and the<Relationships>end tag.If there are no
<Relationship>elements, the package implementer shall remove all characters between the<Relationships>start tag and the<Relationships>end tag.