Issue 90494 - <automatic-styles> can have duplicate style names
Summary: <automatic-styles> can have duplicate style names
Status: CLOSED DUPLICATE of issue 84993
Alias: None
Product: xml
Classification: Code
Component: code (show other issues)
Version: OOo 2.4.0
Hardware: Unknown All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: michael.brauer
QA Contact: issues@xml
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-08 18:53 UTC by sorenroug
Modified: 2008-07-21 10:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
File constructed according to stepwise example (7.65 KB, application/vnd.oasis.opendocument.text)
2008-06-08 18:55 UTC, sorenroug
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description sorenroug 2008-06-08 18:53:55 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>
Comment 1 sorenroug 2008-06-08 18:55:01 UTC
Created attachment 54328 [details]
File constructed according to stepwise example
Comment 2 sorenroug 2008-06-08 20:48:33 UTC
Suggested solution: to use a different prefix when generating names for
automatic styles in styles.xml.
Comment 3 sorenroug 2008-06-10 11:46:31 UTC
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.
Comment 4 jogi 2008-06-24 12:41:27 UTC
@MIB: Is it an implementation issue or an ODF spec issue?
Comment 5 sorenroug 2008-06-24 14:08:31 UTC
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>.
Comment 6 michael.brauer 2008-06-24 14:59:30 UTC
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 ***
Comment 7 michael.brauer 2008-07-21 10:21:39 UTC
closing