Menu

#166 @scope attribute on <rendition/> for CSS pseudo-elements

GREEN
closed
nobody
5
2009-05-29
2009-01-21
brettz9
No

Hi all,

I'd like to suggest adding a @scope attribute to <rendition/> which allows specification of CSS pseudo-elements, in order to more fully utilize the expressive ability of CSS in TEI. These pseudo-elements are used to target styling for only a portion of the given text. For example, there is a 'first-letter' pseudo-element to target styling of the first letter in the targeted element, while there are the useful "before" and "after" pseudo-elements, used often in conjunction with the "content" property to add some styling characters (Unicode provides quite a few) before or after the element.

For example, the CSS "first-letter" pseudo-element might be encoded under this proposal as follows:

<rendition xml:id="dropcaps" scope="first-letter" scheme="css">font-size:xx-large</rendition>
...
<p rendition="#dropcaps">Once upon a time...</p>

The "O" in "Once" would thus be indicated as having drop-caps in the original (and stylesheets could use this information in a predictable and standard way to create such drop-caps). This would not rely on "hacks" such as using XSLT to extract pseudo-element information added within <rendition>

The above would also solve the current need for relying on the non-CSS PRE or POST convention (as used in your default stylesheets) for specifying use of different quotation marks without actually encoding them in the text (:before and :after pseudo-elements could be used under @scope in conjunction with the 'content' property).

<rendition xml:id="quoteBefore" scheme="css" scope="before">content: '"';</rendition>
<rendition xml:id="quoteAfter" scheme="css" scope="after">content: '"';</rendition>
...
<p rendition="#quoteBefore #quoteAfter">Four score and seven years ago...</p>

(The above adds quotation marks--which could instead be curly ones, etc.--at the beginning and end of the paragraph.)

I think this would further build on TEI's advantages in offering to fully allow rendering information of the original to be encoded but while allowing for sufficient separation so that reproducers can choose whether to replicate these features in their own version or not (e.g., in the proposed system, a reproducer could more easily change the style of quotation marks).

Discussion

  • Lou Burnard

    Lou Burnard - 2009-02-01
    • milestone: --> 871209
     
  • Lou Burnard

    Lou Burnard - 2009-03-14
    • milestone: 871209 --> 871207
     
  • Lou Burnard

    Lou Burnard - 2009-04-02
    • milestone: 871207 --> GREEN
     
  • Lou Burnard

    Lou Burnard - 2009-04-02

    see email from dsew 28-3

     
  • Lou Burnard

    Lou Burnard - 2009-05-29

    David Sewell writes on 28/3/09:

    Adding a @scope attribute to <rendition> would
    achieve precisely the same thing that was achieved when pseudo-elements were
    added to the CSS language. As the CSS 2.1 specifications note,
    "Pseudo-elements create abstractions about the document tree beyond those
    specified by the document language. For instance, document languages do not
    offer mechanisms to access the first letter or first line of an element's
    content. CSS pseudo-elements allow style sheet designers to refer to this
    otherwise inaccessible information."
    (http://www.w3.org/TR/CSS21/selector.html#pseudo-elements)

    RECOMMENDATION:

    The feature request should be implemented.

    IMPLEMENTATION NOTES:

    The elementSpec for <rendition> will additionally take <addDef ident="scope"> as
    closed value list, with permitted values being "first-line", "first-letter",
    "before", and "after". (These are all the CSS pseudo-elements defined in
    current CSS as well as in the CSS 3 draft.)

    DISCUSSION:

    There is one potential problem with enabling this @scope attribute, which is
    that apart from :first-letter, the pseudo-elements are perhaps more useful
    for describing the rendition of original XML documents rather than encoded
    texts. For example, the CSS rule

    p:first-line { text-transform: uppercase }

    describes the intended appearance of *output text*, not of original text.
    In a Web browser, as one resizes the window, the length of the first line
    will change. Similarly, if one is transcribing the actual characters of a
    text, one will generally not use :before and :after to generate output text.
    (But the TEI elements for quotation are a clear case where @scope would be
    useful, as Brett notes). If we are clear in the Guidelines about the
    intended use of @scope, I don't think this is a fatal problem.

     
  • Lou Burnard

    Lou Burnard - 2009-05-29
    • status: open --> closed
     
  • Lou Burnard

    Lou Burnard - 2009-05-29

    Implemented at revision 6442