4.1.3 Common Paragraph Elements
Attributes
The paragraph elements have text:style-name,
text:class-names and text:cond-style-name
attributes. These attributes must reference paragraph styles.
A text:style-name attribute
references a paragraph style, while a text:cond-style-name
attribute references a conditional-style, that is, a style that contains
conditions and maps to other styles (see section 14.1.1). If a conditional
style is applied to a paragraph, the text:style-name
attribute contains the name of the style that was the result of the conditional
style evaluation, while the conditional style name itself is the value of the text:cond-style-name attribute. This XML structure
simplifies [XSLT] transformations because XSLT only has to acknowledge the
conditional style if the formatting attributes are relevant. The referenced
style can be a common style or an automatic style.
A text:class-names attribute
takes a whitespace separated list of paragraph style names. The referenced
styles are applied in the order they are contained in the list. If both, text:style-name and text:class-names
are present, the style referenced by the text:style-name
attribute is as the first style in the list in text:class-names.
If a conditional style is specified together with a style:class-names
attribute, but without the text:style-name
attribute, then the first style in the style list is used as the value of the
missing text:style-name attribute.
Conforming applications should support the text:class-names attribute and also should preserve it
while editing.
<define name="paragraph-attrs">
<optional>
<attribute
name="text:style-name">
<ref
name="styleNameRef"/>
</attribute>
</optional>
<optional>
<attribute
name="text:class-names">
<ref
name="styleNameRefs"/>
</attribute>
</optional>
<optional>
<attribute
name="text:cond-style-name">
<ref
name="styleNameRef"/>
</attribute>
</optional>
</define>
Example: Styles and conditional styles
<text:p text:style-name="Heading 1">
"Heading 1" is not a conditional style.
</text:p>
<text:p text:style-name="Numbering 1"
text:cond-style-name="Text body">
"Text body" is a conditional style. If it is
contained in a numbered
paragraph, it maps to "Numbering 1". This is
assumed in this example.
</text:p>
A paragraph may have an ID. This ID can be used to reference
the paragraph from other elements.
<define name="paragraph-attrs"
combine="interleave">
<optional>
<ref
name="text-id"/>
</optional>
</define>