← Prev in month ← Prev in thread
Next in thread → Next in month →

Conditional Styles

From
Daniel Vogelheim <>
Date
2003-08-14T16:10:13+00:00
ID
Thread
Conditional Styles
Hi all,

My action item was to explain how conditional styles work. Consider a 
style which is supposed to look different depending on the position of 
the document, so that e.g. a complete document could be formatted as 
style 'mapped-style', but still render sensibly. E.g., the following 
would have inherited "Standard" attributes for normal text, but would 
use "footnote-style", "header-style" and "footer-style" for footnotes, 
headers and footers, respectively.

<style:style style:name="mapped-style"
    style:family="paragraph"
    style:parent-style-name="Standard"
    style:class="text">
  <style:map style:condition="footnote()" 
style:apply-style-name="footnote-style"/>
  <style:map style:condition="header()" 
style:apply-style-name="header-style"/>
  <style:map style:condition="footer()" 
style:apply-style-name="footer-style"/>
</style:style>

In the text document, paragraphs look as follows:
Normal:  <text:p text:style-name="mapped-style">
Footnote: <text:p text:style-name="footnote-style" 
text:cond-style-name="mapped-style">
Header: <text:p text:style-name="header-style" 
text:cond-style-name="mapped-style">
Footer: <text:p text:style-name="footer-style" 
text:cond-style-name="mapped-style">

So in order to _render_ the document, one can _always_ access the style 
properties for the style in 'text:style-name'. Only if one is interested 
in (re-)evaluating the conditions, one needs to look at 
text:cond-style-name attribute to find the style which contains the map. 
Applications that don't understand would thus function without any 
problems, except that they would loose the style mapping (unless the 
relevant maps/attributes are preserved). Applications that do understand 
would have to look at text:cond-style-name to find the mapped style, and 
would only use text:style-name in case no text:cond-style-name attribute 
is present.

Sincerely,
Daniel
← Prev in month ← Prev in thread
Next in thread → Next in month →