Attributes

Attributes are an important part of the XML structure, and have not yet been mentioned. Where an element appears in a particular document variant, and is not fragmented, it is simple to add the attributes onto that element as part of the start tag. When an element has been fragmented, then the attributes for that element will appear in the start tag, i.e. the element with the dxTagStart attribute. This means that any attributes that appear on a middle tag or end tag would not be relevant to a particular document variant.

This is an example of simple overlap including some attribute data:

<p>The quick brown fox. It jumped over the lazy dog.</p>
<p>The quick brown fox.</p><p class="B"> It jumped over the lazy dog.</p>

This is represented as:

<p dxTagStart="A" dxTag="B" dx="A,B">The quick brown fox.</p>
<p dxTagEnd="A" dxTag="B" dx="A,B" class="B"> It jumped over the lazy dog.</p>

This shows the class attribute but an attribute applies only to those variants where the tag is a dxTag or dxTagStart. Therefore class="B" applies only to the B document because for A this <p> is an end tag.

Changes to attributes can also be represented. This is done by converting the attribute into markup as part of a new first child of the element. Although theoretically possible to represent changes to attributes within attributes, this leads to some dedicated syntactic conventions within the attribute string, which is not easy to process. Therefore separating change attributes out into XML markup makes processing, particularly using XSLT, much easier.

This is an example of simple overlap, including some changed attribute data:

<p class="B" align="left">The quick brown fox. It jumped over the lazy dog.</p>

<p class="B" align="right">The quick brown fox.</p><p> It jumped over the lazy dog.</p>

This is represented as:

<p dxTagStart="A" dxTag="B" dx="A,B" class="B">
  <deltaxml:attributes>
    <dxa:align dx="A,B">
      <deltaxml:attributeValue dx="A">left</deltaxml:attributeValue>
      <deltaxml:attributeValue dx="B">right</deltaxml:attributeValue>
    </dxa:align>
  </deltaxml:attributes>
The quick brown fox.</p>
<p dxTagEnd="A" dxTag="B" dx="A,B"> It jumped over the lazy dog.</p>

This shows that the unchanged attribute, class="B", remains as an attribute, but the changed align attribute is represented as markup to show the two values. This is a simplified representation and full details can be found in the documentation of the DeltaXML DeltaV2.1 format [11].

The delta representation also allows an alternative representation because the <p> tag in the A document can be wrapped around the two <p> tags in the B document, as shown below:

<p dxTag="A" dx="A,B" class="B" align="left">
 <p dxTag="B" dx="A,B" class="B" align="right">The quick brown fox.</p>
 <p dxTag="B" dx="A,B"> It jumped over the lazy dog.</p>
</p>

This is, in this case, a shorter representation though it has in effect used duplication of the (unchanged) attributes and tags to show the change. However, this may be a preferred representation for some formatting elements, for example if the class attribute in a <span> is changed then it may be more useful to represent this as a different <span>. Both representations conform to the delta format.