Apache OpenOffice (AOO) Bugzilla – Issue 90494
<automatic-styles> can have duplicate style names
Last modified: 2008-07-21 10:21:39 UTC
Chapter 14 of OpenDocument specification 1.0 clearly says that the <office:styles>, <office:automatic-styles> and <office:master-styles> elements each must not contain two styles with the same famility and the same name. However, it is very easy to trip up OpenOffice Writer so that it uses the same style name for an automatic style in styles.xml that is different from an automatic style in content.xml but having different properties. The effect is that other programs that read ODT files can get misunderstand the information. To replicate: Launch an OpenOffice writer (tried up to v. 2.4.0) Change the "Default" page style to turn header on. Write three words in page header. Highlight the middle word (by double-clicking) and make it Bold and also Italic (in that order) Write three words an an ordinary paragraph. Then highlight the middle work (by double-clicking) and make it Bold. Save and inspect the styles.xml and content.xml styles.xml will have this: <office:automatic-styles> <style:style style:name="T1" style:family="text"> <style:text-properties fo:font-style="italic" fo:font-weight="bold" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-style-complex="italic" style:font-weight-complex="bold"/> </style:style> content.xml will have this: <office:automatic-styles> <style:style style:name="T1" style:family="text"> <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> </style:style>
Created attachment 54328 [details] File constructed according to stepwise example
Suggested solution: to use a different prefix when generating names for automatic styles in styles.xml.
In chapter 2.1 of the OpenDocument specification 1.1, it says that an ODF file can take the form of a single XML document or as a collection of several subdocuments within a package. In the first case the document root is <office:document> and it contains all the top-level elements. When OOo generates an automatic style called T1 in styles.xml and a different automatic style called T1 in content.xml it becomes very difficult to merge styles.xml, settings.xml, meta.xml and content.xml into a single XML document. You'd have to rename the styles when you detect clashes. It can not have been OASIS' intention to allow two identical style names eventhough one is in styles.xml and the other is in content.xml.
@MIB: Is it an implementation issue or an ODF spec issue?
It is an implementation issue. My assertion is that the ODF spec does not allow OOo to save a document with a style called "S1" in styles.xml:<automatic- styles> and a different style called "S1" in content.xml:<automatic-styles>.
The ODF 1.0/1.1 specifications allow actually to use the same names in styles.xml and content.xml. For ODF 1.2 we added that they should be different. That's #i84993# *** This issue has been marked as a duplicate of 84993 ***
closing