Difference between revisions of "Proposal for @selector attribute on rendition"
(→Rationale) |
(→Rationale) |
||
Line 42: | Line 42: | ||
margin-top: 0; | margin-top: 0; | ||
</rendition> | </rendition> | ||
+ | </code> | ||
+ | |||
+ | ==Details== | ||
+ | |||
+ | This is the proposed ODD fragment, to be added to att.styleDef.xml: | ||
+ | |||
+ | <code> | ||
+ | <attDef ident="selector"> | ||
+ | |||
+ | |||
+ | </attDef> | ||
</code> | </code> |
Revision as of 18:38, 25 May 2015
This proposal arises out of FR 520, which presents a number of ideas for enhancements to the <rendition> element. This proposal is the simplest and most straightforward, consisting of a single new attribute, which I believe will be the least controversial and easiest to implement.
Rationale
The combination of <rendition> and @rendition currently allows us to link specific elements with blocks of style code (almost always CSS) in the manner of the HTML @class attribute, and @style allows the direct application of CSS to a specific element. What we cannot currently do is specify a default rendition for an element or a set of elements, except through the use of <tagUsage>/@render; this is crude in allowing only the linking of style blocks with unqualified elements, and it also brings in the requirement that every element used be provided with a matching <tagUsage> element.
I would argue that a better approach would be a new attribute called @selector available on the <rendition> element, through the att.styleDef class. Its definition would be:
A selector or series of selectors specifying the elements to which the contained style description applies, expressed in the language specified in the @scheme attribute.
This would allow simple definitions like the following:
<rendition
scheme="css"
selector="text front back body div p ab">
display: block;
</rendition>
making this a straighforward way in which to express a basic mapping between TEI elements and their default styles. It would of course allow much more sophisticated mapping, including for instance the use of @rend:
<rendition
scheme="css"
selector="*[rend*=italic]">
font-style: italic;
</rendition>
and would make it easy to express different default rules for the same element in different contexts:
<rendition
scheme="css"
selector="front p, back p">
margin-top: 0.5em;
</rendition>
<rendition
scheme="css"
selector="body p">
margin-top: 0;
</rendition>
Details
This is the proposed ODD fragment, to be added to att.styleDef.xml:
<attDef ident="selector">
</attDef>