Its0509ReqNestedElements

From W3C Wiki
Jump to: navigation, search


ITS WG Collaborative editing page

Follow the conventions for editing this page.

Status: Initial Draft ie. please focus on technical content, rather than wordsmithing at this stage.

Author: Yves Savourel

Nested Elements

Summary

[R022] Great care must be taken when defining or using nested translatable elements.

Challenges

An XML can allow the recursive nesting of the same elements. In some cases such structure is detrimental to the localization process as it creates great difficulties for the translation tools to segment or extract the text.

An example, the <footnote> in OpenOffice documents:

A <text:p> element can contain a <text:footnote> element. The <text:footnote> includes a <text:footnote-body> element, which in turn, can also contain a <text:p> element. This may lead to situation where one or more paragraphs are embedded within each other.


<text:p text:style-name="Text body">Donec leo massa, porttitor non, laoreet et, tincidunt nec, 
turpis<text:footnote text:id="ftn0"><text:footnote-citation>1</text:footnote-citation><text:footnote-body><text:p
text:style-name="Footnote">Here comes the first footnote's text.</text:p></text:footnote-body></text:footnote>. 
Morbi ultricies imperdiet erat<text:footnote 
text:id="ftn1"><text:footnote-citation>2</text:footnote-citation><text:footnote-body><text:p 
text:style-name="Footnote">Here comes the second footnote's text.</text:p></text:footnote-body></text:footnote>. Nam 
aliquam, magna eget eleifend varius, orci quam condimentum enim, in consectetuer neque purus a massa. Mauris 
gravida felis et neque. Nullam tristique arcu sed nulla.</text:p>


Having two <text:p> elements withing a parent <text:p> element makes processing of the data difficult. For example it is more difficult, for most localization tools, to decide if <text:p> should be treated as inline code or not.

Quick Guidelines

Avoid to allow the definition of a reference inside the structure where it's referenced. In other words, </text:footnote-body> should be outside <text:p>.