4.4.1 Orderable Same Name Siblings

If the parent node supports orderable child nodes and same-name siblings then the same-name sibling child nodes will be orderable by the application just like an other child nodes. For example, given the following initial ordering of child nodes,

[A, B, C, A, D]

a call to

orderBefore("A[2]","A[1]")

will cause the child node currently called A[2] to be moved to the position before the child node currently called A[1], the resulting order will be:

[A, A, B, C, D]

where the first A is the one that was formerly after C and the second A is the one that was formerly at the head of the list.

Note, however, that after the completion of this operation the indices of the two nodes have now switched, due to their new positions relative to each other. What was formerly A[2] is now A[1] and what was formerly A[1] is now A[2].