
On 11/7/2012 1:49 PM, Robert Gibbins wrote:
However the reason I didn't go this way to start with is that use of the style attribute appears to be deprecated in both the epub 2 and epub 3 specifications. I assume this means that sooner or later the standard will drop support for it. Have I misunderstood?
Probably. The code word we are dealing with here is "inline style." In ePub 2 there was a single comment stating, "This specification supports the inline style attribute (deprecated), the XHTML style element, and externally linked (via link elements or the xml-stylesheet processing instruction) style sheets." However, there was never any explicit declaration that inline styles were definitively deprecated. In early drafts of the ePub 3 specification it included the phrase, "Content Documents, like any HTML documents, may reference style sheets or include inline style information." That phrase was later removed from the specification, and no further reference to inline styles was included. Instead, the ePub 3 specifications provides, "Unless otherwise specified, this specification inherits all definitions of semantics, structure and processing behaviors from the [HTML5] specification." The style attribute is still part of HTML5, so I think it is safe to say that inline styles are still an accepted part of ePub. From a practical point of view, every ePub user agent I am aware of that can parse CSS style sheets (including internal style sheets) can also parse and apply inline styles. I'm sure this is because virtually every ePub user agent wraps an existing HTML rendering engine. Extracting inlines style and placing them into a style sheet is a rather trivial programming effort--HTML Tidy does a very similar thing right now. If ePub ever /does/ deprecate inline styles, I'll volunteer to write the program to transform inline styles into an internal style sheet.