Difference between revisions of "Proposal for @selector attribute on rendition"
(→Chapter prose) |
(→Chapter prose) |
||
Line 95: | Line 95: | ||
===Chapter prose=== | ===Chapter prose=== | ||
These are proposed changes to the prose of Chapter 2: | These are proposed changes to the prose of Chapter 2: | ||
+ | |||
+ | [http://www.tei-c.org/release/doc/tei-p5-doc/en/html/HD.html#HD57 2.3.4 The Tagging Declaration] | ||
One or more such specifications may be associated with elements of a document in <s>two</s> <b>three</b> ways: | One or more such specifications may be associated with elements of a document in <s>two</s> <b>three</b> ways: |
Revision as of 18:57, 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.
Contents
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
ODD
This is the proposed ODD fragment, to be added to att.styleDef.xml:
<attDef ident="selector">
<desc versionDate="2015-05-25" xml:lang="en">
A selector or series of selectors specifying the elements to which the contained style
description applies, expressed in the language specified in the <att>scheme</att> attribute.
</desc>
<datatype maxOccurs="1">
<ref xmlns="http://relaxng.org/ns/structure/1.0" name="data.text"/>
</datatype>
<exemplum xml:lang="en">
<egXML xmlns="http://www.tei-c.org/ns/Examples">
<rendition
scheme="css"
selector="text front back body div p ab">
display: block;
</rendition>
</egXML>
</exemplum>
<exemplum xml:lang="en">
<egXML xmlns="http://www.tei-c.org/ns/Examples">
<rendition
scheme="css"
selector="*[rend*=italic]">
font-style: italic;
</rendition>
</egXML>
</exemplum>
<remarks versionDate="2015-05-25" xml:lang="en">
Since the default value of the <att>scheme</att> attribute is assumed to be CSS, the default
expectation for this attribute, in the absence of <att>scheme</att>, is that CSS selector
syntax will be used.
</remarks>
<remarks versionDate="2015-05-25" xml:lang="en">
While <att>rendition</att> is used to point from an element in the transcribed source to a
<gi>rendition</gi> element in the header which describes how it appears, the <att>selector</att>
attribute allows the encoder to point in the other direction: from a <gi>rendition</gi> in the
header to a collection of elements which all share the same renditional features. In both cases,
the intention is to record the appearance of the source text, not to prescribe any particular
output rendering.
</remarks>
</attDef>
Chapter prose
These are proposed changes to the prose of Chapter 2:
One or more such specifications may be associated with elements of a document in two three ways:
- the @render attribute of the appropriate tagUsage element may be used to indicate a default rendition for all occurrences of the named element
- the @selector attribute on any <rendition> element may be used to select a collection of elements to which it applies
- the global @rendition attribute may be used on any element to indicate its rendition, overriding or complementing any supplied default value