Styles in ODF
Styles is a complex subject in ODF but the basic ideas are simple.
A 'style' is a collection of properties, each of them with a name and a value. They are collected into property sets that apply to specific types of data. For example a style that applies to text in general have text-properties only. A style that applies to paragraphs have both text-properties and paragraph-properties. Other types of styles have other property set depending on which type of data they apply to.
The two main files in an ODF zip store are called content.xml and styles.xml. The file styles.xml contains so called named styles, i.e. those that the user can choose between in a typical user interface. Paragraph styles like "Default", "Heading 1", etc is the typical example, but also other types of styles can be named: Character styles, graphic styles, table styles, cell styles (spreadsheets), chart styles and so on.
Now, suppose the user makes a formatting change is made that does not involve applying a named style or changing a named style, such as setting some characters to bold. In this case a new style without a name is created to hold the difference between the properties of the named style that apply to the text in question and the actual format. In our example with bold, the only property that it will hold is the bold property.
Such a an unnamed style is called automatic style because they are created automatically when formatting is changed. These automatic styles are stored in the same file as the data they refer to which means content.xml with a few exceptions. The exception is when the actual contents is stored in styles.xml like page headers and footers in text documents (headers/footers are part of the page style).
Named style can have a parent style, which means that when a property is not defined in the style it is also looked up in the parent style. If it is not found there then the parent's parent is searched and so on. All automatic styles have a parent style, which is a named style. An automatic style can never have another automatic style as parent.
A document can also define so called default style which are used when a property is not found anywhere along the chain of parent styles. If a property is found even there its value is undefined and it is up to each application to define the default values.