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

  1. The package implementer shall process the versioning instructions, considering that the only known namespace is the Relationships namespace.

  2. The package implementer shall remove all ignorable content, ignoring preservation attributes.

  3. The package implementer shall remove all versioning instructions.

Step 2: Sort and filter relationships

  1. The package implementer shall remove all namespace declarations except the Relationships namespace declaration.

  2. The package implementer shall remove the Relationships namespace prefix, if it is present.

  3. The package implementer shall sort relationship elements by @Id value in lexicographical order, considering @Id values as case-sensitive Unicode strings.

  4. The package implementer shall remove all <Relationship> elements that do not have eitheran @Id value that matches any @SourceId valueor a @Type value that matches any @SourceType value, among the @SourceId and @SourceType values 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 @Id value that matches a @SourceId value or a @Type value that matches a @SourceType value specified in the transform definition.

Step 3: Prepare for canonicalization

  1. The package implementer shall remove all characters between the <Relationships> start tag and the first <Relationship> start tag.

  2. The package implementer shall remove any contents of the <Relationship> element.

  3. The package implementer shall remove all characters between the last <Relationship> end tag and the <Relationships> end tag.

  4. If there are no <Relationship> elements, the package implementer shall remove all characters between the <Relationships> start tag and the <Relationships> end tag.