Comprehensive CSS Stylesheet

From TEIWiki
Jump to navigation Jump to search

The following is an attempt to gradually build CSS for each TEI element, paralleling the default TEI stylesheets (while also potentially serving as a kind of discussion center for how the stylesheets ought to operate (see Formatting TEI documents on how there is a need for this despite TEI being agnostic as to output formatting), at least for issues pertaining solely to formatting as opposed to semantics), by indicating here necessary deviations from the XHTML stylesheets (due to CSS constraints) or potentially desirable alternatives, etc.).

Advantages of CSS (compared to XSL)

  1. Simpler for maintenance/alteration (though CSS can still be combined with simpler XSL as needed)
  2. Simpler for communicating the underlying behavior and inviting discussion on assumptions
  3. Downloading (and parsing?) is faster
  4. Wider browser support (and for browser caching?)
  5. Allows DOM and other manipulation directly on semantically-named TEI elements (though admittedly, use of frameworks like jQuery may make traversal of X/HTML as easy or easier and XBL, were it to be implemented in browsers (as planned in Firefox) and forgo discouraging semantic alterations, could preserve the DOM (unlike typical stylesheets) while rendering according to a kind of transformation)
  6. TEI could potentially be used as is in HTML (though empty self-closing elements will not be treated properly unless changed to <elem></elem> form and namespaces will not be present) in addition to true XHTML.
  7. If the selectors were changed, the style rules could be applied to an HTML5 serialization of TEI, being in a language already familiar to web developers

Disadvantages of CSS (compared to XSL)

  1. Does not allow transformations such as re-ordering and duplication (thus no automatically generated indexes, tables of contents, etc).
  2. Is cumbersome for certain variable structures (e.g., for values varying by integer but not including the integer (e.g., space.extent => number of spaces) a separate rule must be created for each possible attribute value).
  3. Unable to create form controls and some other HTML GUI components.
  4. Assumes that the structure of the TEI essentially similar to the desired output (thus no stand-off markup; switching between multiple overlapping hierarchical structures; etc).

Features of XSL which are impossible to leverage in a CSS stylesheet for TEI

We will not be able to make equivalents for XSLT templates like rendToClass (e.g., ab) or applyRend (emph), applyRendition (emph) since we cannot (nor do we need to) add an id or class (though @rend or @rendition would be useful to utilize, there is no "eval()"-like code in CSS; however, we could test against predefined values like "bold" (maybe as a global * or at least the elements using these in the stylesheets (emph, hi, ...))).

Namespaces

Per CSS Namespaces, one can use either

@namespace "http://www.tei-c.org/ns/1.0"

or

@namespace tei "http://www.tei-c.org/ns/1.0"

...but we will use the former since we will presume the stylesheet will be primarily (if not exclusively) for TEI.

(Level of completion)

All fields below should be complete for an element, or otherwise noted that it is incomplete, so that it can otherwise be assumed that the CSS has been completely applied as far as possible (besides rend/rendition which may later be done globally for all elements, as these are indeed globals).

Alphabetical

a

ab {display:block;}
choice > expan + abbr:before {content:"("} /* Assumes inside choice and expan before abbr */
choice > expan + abbr:after {content:")"} /* Assumes inside choice and expan before abbr */
accMat {display: block;} accMat:before {content: "Accompanying material: "; font-weight: bold;}
history acquisition:before {content: "Acquisition: ";font-weight: bold;} history acquisition {display: block;}
  • activity (XSL has not yet covered (from language module))
actor {display:inline; font-style: italic;}
add[place="sup"] {vertical-align:super;} add[place="sub"] {vertical-align:sub;}
  • addName (XSL has not yet covered (from namesdates module))
  • addSpan
additional {padding-top: 3pt; padding-bottom: 2pt; display: block;} additional>listBibl>bibl:after {content: ".";} additional:before {content: "Additional:";display: block;font-weight: 600;   font-variant: small-caps;font-size: 120%;} additional>listBibl {display: block;list-style-type: none;margin-top: 10pt;} additional>listBibl:before {content: "Bibliography:";display: block;font-weight: 600;font-variant: small-caps;font-size: 120%;} additional>listBibl>bibl {text-align: left;display: list-item;margin-left: 30pt;}
additions {display: block;} additions:before {content: "Additions: ";font-weight: bold;}
addrLine {display:block;}
address {display:block; /* font-style:italic; If wish to appear as HTML addresses are rendered by default, at least in Firefox */}
  • adminInfo
  • affiliation
  • age
  • alt
  • altGrp
  • altIdent
  • altIdentifier
  • am
  • analytic
  • anchor
  • app
  • appInfo
  • application
  • arc
  • argument
att {display:inline; font-weight:bold;} att:before {content:"@"}
  • attDef
  • attList
  • attRef
  • author
  • authority
  • availability

b

  • back
  • bibl
  • biblFull
  • biblScope
  • biblStruct
  • bicond
  • binary
  • binaryObject
  • binding
  • bindingDesc
  • birth
  • bloc
  • body
  • broadcast
byline {display:block;}


c

  • c
  • cRefPattern
caesura:before {display:inline; content:"\a0\a0\a0\a0"; /* could be :after too */}
camera {display:inline; font-style: italic;}
caption {display:inline; font-style: italic;}
  • case
  • castGroup
  • castItem
castList {} /* Note: has additional rules: */
castList {display:block;} /* applies whether children are head or not */
/* Note: for this to mirror the XSL exactly, head would always need to be preceding other elements as a direct child castList */
castList > head {display:inline; font-style:italic;}
castList > *:not(head) {margin-left: 40px;} /* If children of castList needed their own indents, then it should be relative to this (if possible) */
  • catDesc (Only defined in XSL conditionally if using catRef)
catRef {} /* Note: has additional rules: */
catRef + catRef:before {'\A'} /* Add line break if preceded by another catRef */
catRef:after {content:attr(scheme); display:inline; font-style:italic;} /* Add scheme in italics */
/* 
Commenting out as XPath not currently supported in CSS as needed by third 'after'
catRef:after(2) {content:':'}*//* Requires CSS3 to add such additional 'after' content? (Firefox allows content: '123'attr(class)'456' at least); See http://www.w3.org/TR/css3-content/#nesting or http://www.w3.org/TR/css3-content/#inserting0 */
/* 
catRef:after(3) {content: <not possible to reference target's catDesc unless XPath gets added to CSS>} */
  • catchwords
  • category
  • cb
  • cell
  • certainty
  • change
  • channel
  • char
  • charDecl
  • charName
  • charProp
  • choice
  • cit
  • cl
  • classCode (XSL has not yet covered (from header module))
  • classDecl
  • classSpec
  • classes
  • climate
  • closer
code {display:inline; font-family:monospace;}
  • collation
  • collection
  • colloc
  • colophon
  • cond
  • condition
  • constitution
  • constraint
  • constraintSpec
  • content
  • corr
  • correction
  • country
  • creation
  • custEvent
  • custodialHist

d

  • damage
  • damageSpan
  • datatype
  • date
  • dateline
  • death
  • decoDesc
  • decoNote
  • def
  • default
  • defaultVal
del {display:inline; text-decoration: line-through;}
  • delSpan
  • depth
  • derivation
  • desc
  • dictScrap
  • dim
  • dimensions
  • distinct
  • distributor
  • district
  • div
  • div1
  • div2
  • div3
  • div4
  • div5
  • div6
  • div7
  • divGen
  • docAuthor
  • docDate
  • docEdition
  • docImprint
  • docTitle
  • domain

e

  • eLeaf
  • eTree
  • edition
  • editionStmt
  • editor
  • editorialDecl
  • education
  • eg
  • egXML
  • elementSpec
  • email
emph {display:inline; font-style:italic;}
  • encodingDesc
  • entry
  • entryFree
epigraph {display:block;}
  • epilogue
  • equipment
  • equiv
  • etym
  • event
  • ex
  • exemplum
choice > expan + abbr:before {content:"("} /* Assumes inside choice and expan before abbr */
choice > expan + abbr:after {content:")"} /* Assumes inside choice and expan before abbr */
  • explicit
  • extent

f

  • f
  • fDecl
  • fDescr
  • fLib
  • facsimile
  • factuality
  • faith
  • figDesc
  • figure
  • fileDesc
  • filiation
  • finalRubric
  • floatingText
  • floruit
  • foliation
foreign {display:inline;}
  • forename
  • forest
  • forestGrp
  • form
  • formula
  • front
  • fs
  • fsConstraints
  • fsDecl
  • fsDescr
  • fsdDecl
  • fsdLink
  • funder
  • fvLib
  • fw

g

  • g
  • gap
  • gen
genName {display:inline;}
  • geo
  • geoDecl
  • geogFeat
geogName {display:inline;}
gi:before {display:inline;content:"<"}  gi:after {display:inline;content:">"}
gloss {display:inline;}
  • glyph
  • glyphName
  • gram
  • gramGrp
  • graph
  • graphic
  • group

h

  • handDesc
  • handNote
  • handNotes
  • handShift
  • head
  • headItem
  • headLabel
  • height
  • heraldry
hi {display:inline; font-weight:bold;}
  • history
  • hom
  • hyph
  • hyphenation

i

  • iNode
  • iType
ident[type] {display:inline; font-weight:bold;} ident:not([type]) {display:inline; } /* Just as the stylesheet allows for different types; a specific type could be styled by ident[type="XXX"] */
  • idno
  • if
  • iff
  • imprimatur
  • imprint
  • incident (speech module: XSL has not yet covered)
  • incipit
  • index
  • institution
  • interaction
  • interp
  • interpGrp
  • interpretation
  • item

j

  • join
  • joinGrp

k

  • keywords (XSL has not yet covered (from header module))
  • kinesic (speech module: XSL has not yet covered)

l

l {display:block;}
label {display:inline;}
  • lacunaEnd
  • lacunaStart
  • lang
  • langKnowledge
  • langKnown
  • langUsage
  • language
  • layout
  • layoutDesc
lb {display:block;}
  • lbl
  • leaf
  • lem
lg {display:block;}
  • link
  • linkGrp
  • list
  • listBibl
  • listEvent
  • listNym
  • listOrg
  • listPerson
  • listPlace
  • listRef
  • listWit
  • localName
  • locale
  • location
  • locus
  • locusGrp

m

  • m
  • macroSpec
  • mapping
  • material
  • measure
  • measureGrp
  • meeting
  • memberOf
mentioned {display:inline;}
  • metDecl
  • metSym
  • milestone
  • moduleRef
  • moduleSpec
  • monogr
  • mood
  • move
  • msContents
  • msDesc
  • msIdentifier
  • msItem
  • msItemStruct
  • msName
  • msPart
  • musicNotation

n

name {display:inline;}
  • nameLink
  • namespace
  • nationality
  • node
  • normalization
  • note
  • notesStmt
  • num
  • number
  • numeric
  • nym

o

  • oRef
  • oVar
  • objectDesc
  • occupation
  • offset
  • opener
  • org
  • orgName
  • orig
  • origDate
  • origPlace
  • origin
  • orth

p

  • p
  • pRef
  • pVar
  • particDesc
  • pause (speech module: XSL has not yet covered)
  • pb
  • pc
  • per
  • performance
persName {display:inline;}
  • person
  • personGrp
  • phr
  • physDesc
  • place
placeName {display:inline;}
  • population
  • pos
  • postBox
  • postCode
  • postscript
  • precision
  • preparedness
  • principal
  • profileDesc
  • projectDesc
  • prologue
  • pron
  • provenance
  • ptr
  • pubPlace
  • publicationStmt
  • publisher
  • purpose

q

  • q
  • quotation
  • quote

r

  • rdg
  • rdgGrp
  • re
  • recordHist
  • recording
  • recordingStmt
  • ref
  • refState
  • refsDecl
  • reg
  • region
  • relatedItem
  • relation
  • relationGrp
  • remarks
  • rendition
  • repository
  • residence
resp:after {content:" ";}
respStmt {display:inline;}
  • respons
  • restore
  • revisionDesc
  • rhyme
role {display:inline; font-style: italic;}
roleDesc { margin-left: 40px; margin-right: 40px; } roleDesc > *:not(p) {display:block; margin-bottom:1em; /* Latter is to act like a paragraph*/}
roleName {display:inline;}
  • root
  • row
  • rs
  • rubric

s

  • s
  • said
salute {text-align:left; display:block; margin-bottom:1em; /* Latter is to act like a paragraph*/}
  • samplingDecl
  • schemaSpec
  • scriptStmt
  • seal
  • sealDesc
  • secFol
seg {display:inline;}
  • segmentation
  • sense
  • series
  • seriesStmt
set {display:inline; font-style: italic;}
  • setting
  • settingDesc
  • settlement
  • se x (XSL has not yet covered (namesdates module)) /* space-separated for spam filter! */
  • shift (speech module: XSL has not yet covered)
sic {display:inline;} sic:after {content: " (sic)"}
  • signatures
signed {text-align:left; display:block; margin-bottom:1em; /* Latter is to act like a paragraph*/}
soCalled:before {content:'‘'} soCalled {display:inline;} soCalled:after {content:'’'} /* Quote style is parameterized in XSL; note: content can also accept 'open-quote' and 'close-quote', but the default is as already included in the rule */
  • socecStatus
sound {display:inline; font-style: italic;}
  • source
  • sourceDesc
  • sp
  • space
  • span
  • spanGrp
  • speaker
  • specDesc
  • specGrp
  • specGrpRef
  • specList
  • sponsor
stage {font-style: italic; display:block; margin-bottom:1em; /* Latter is to act like a paragraph*/}
  • stamp
  • state
  • stdVals
  • street
  • stress
  • string
  • stringVal
  • subc
  • subst
  • summary
  • superEntry
  • supplied
  • support
  • supportDesc
  • surface
  • surname
  • surplus
  • surrogates
  • syll
  • symbol

t

  • TEI
  • table
  • tag
  • tagUsage
  • tagsDecl
  • taxonomy
tech {display:inline; font-style: italic;}
  • teiCorpus
  • teiHeader
term {display:inline;}
  • terrain
  • text
  • textClass
  • textDesc
  • textLang
  • then
  • time
  • timeline
  • title
  • titlePage
  • titlePart
  • titleStmt
  • tns
  • trailer
  • trait
  • tree
  • triangle
  • typeDesc
  • typeNote

u

  • u (speech module: XSL has not yet covered)
unclear {display:inline;}
  • unicodeName
  • usg

v

  • vAlt
  • vColl
  • vDefault
  • vLabel
  • vMerge
  • vNot
  • vRange
  • val
  • valDesc
  • valItem
  • valList
  • value
  • variantEncoding
view {display:inline; font-style: italic;}
  • vocal (speech module: XSL has not yet covered)

w

  • w
  • watermark
  • when
  • width
  • wit
  • witDetail
  • witEnd
  • witStart
  • witness
  • writing (speech module: XSL has not yet covered)

x

  • xr

y

(none)

z

z

  • zone

References used