Print

Print


On 1/22/2009 9:09 PM, Martin Holmes wrote:
> Hi Brett,
>
> Brett Zamir wrote:
>> Hi Martin and all,
>>
>> I can't really see any pseudo-classes which would be strictly 
>> necessary on a per-element level, at least to indicate /original/ 
>> formatting, though I guess it wouldn't hurt to allow them.
>
> The example that started this discussion, the pilcrow preceding every 
> <head>, is one such.
My meaning was I didn't see any pseudo-/classes/ that were necessary on 
such a level, unless the TEI document /is /the original document, but I 
do see value for the pseudo-/elements/ (as in the pilcrow example).
>> By the way, I had forgotten there is already a CSS quotes property. 
>> Also, this CSS3 spec draft is very interesting: 
>> http://www.w3.org/TR/css3-content/
>>
>> As far as stylesheets, while they may not strictly be necessary, by 
>> using global selectors, it can avoid a lot of duplication (though it 
>> makes it more difficult to do something (without scripting) like 
>> allow document consumers to search only for specific text that is in 
>> italics, as the user may have remembered it as such without knowing 
>> its element type).
>
> Would it? If you can search for <hi rend="italics">, can't you search 
> for <hi cssClass="whatever">?
My reference was to global selectors in whole stylesheets, not for 
inline usage which, as you point out, does preserve the connection. For 
example, this wouldn't preserve the connection so clearly:

<cssStylesheet>
     hi {font-style:italic}
</cssStylesheet>
.....
<hi>...</hi>

If you were, for example, in a browser, you might be able to use 
getComputedStyle() in JavaScript (or do some difficult string parsing), 
but otherwise, the association is lost (but such associations are also 
lost in any example of the separate-formatting-from-content paradigm).
>> I notice, however, that in using <html:style> (in Firefox at least), 
>> even without xml-stylesheet, use of <html:style> actually does apply 
>> the styling to the document (and doesn't render the style contents). 
>> But if <html:style> is meant to only indicate original formatting in 
>> TEI, then this is a problem (at least with Firefox), since in such a 
>> case, it should not be used as formatting instructions without 
>> xml-stylesheet explicitly targeting it (in XHTML, the recommended 
>> usage per http://www.w3.org/TR/xhtml1/#C_14 is to specify 
>> <?xml-stylesheet?> for each inner style tag). It also seems like 
>> html:style should only work (if it works at all in plain XML 
>> documents like TEI) with items in the HTML namespace, but in Firefox 
>> at least, this is not the case.
>>
>> Unfortunately this convention for xml-stylesheeet in XHTML (at 
>> http://www.w3.org/TR/xhtml1/#C_14) is not part of the spec for 
>> xml-stylesheet in XML (at http://www.w3.org/TR/xml-stylesheet/) 
>> (which might have relied on xml:id, though some hiding of the XML 
>> "style" tag would need to have display:none assigned (unless perhaps 
>> some element were allowed in the reserved xml: namespace), since all 
>> plain XML contents are shown by default). So, plain XML does not seem 
>> to allow any formal XML-spec-compliant way to specify an internal 
>> stylesheet.
>
> As far as I can see, the W3C specification is clear about applying a 
> CSS stylesheet to XML, and it works, at least when the stylesheet is 
> external (I haven't tried it internally). 
That's what I meant. It allows external ones, but doesn't allow internal 
ones (though XHTML does, utilizing xml-stylesheet in so doing).
> You would want to add display: none to the teiHeader as a whole, of 
> course, if the stylesheet was intended to reproduce something close to 
> the original.
>
Yes.
>> When trying this in practice, however, Firefox (3.0) at least has 
>> some odd behavior in this connection too. For example, this doesn't 
>> work at all:
>>
>> <?xml-stylesheet href="#myStylesheet" type="text/css"?>
>> <root>
>> <css xml:id="myStylesheet"><!-- same effect with or without xml:id or 
>> with 'id' -->
>> el{color:red;}
>> </css>
>> <el>abc</el>
>> </root>
>
> Ah -- then my cunning plan is shot down, at least for Firefox 3.0.
>
>> but when put as a 2nd rule, here it does (but the first rule is 
>> ignored):
>>
>> <?xml-stylesheet href="#myStylesheet" type="text/css"?>
>> <root>
>> <css xml:id="myStylesheet"> <!-- same effect with or without xml:id 
>> or with 'id'-->
>> style{display:none;}
>> el{color:red;}
>> </css>
>> <el>abc</el>
>> </root>
>
> That just looks like a bug to me -- do you mean that style{display: 
> none} is ignored, but the subsequent el{color: red} works?
Yes. (Btw, my style rule should have been css{display:none;}).

It turns out the first line is ignored.

This works:

<?xml-stylesheet href="#myStylesheet" type="text/css"?>
<root>
<css xml:id="myStylesheet"> <!-- same effect with or without xml:id or 
with 'id'-->

     blah{}
     css{display:none;}
     el{color:red;}
     el2{color:blue;}

</css>
<el>abc</el>
<el2>abc</el2>
</root>

So, yeah, it must be a bug (as is the fact that it works even without 
the id attribute!), and even if it were fixed, the specification cited 
above doesn't explicitly allow internal stylesheets in non-XHTML XML. 
But external xml-stylesheet's are fine--to indicate /output/ formatting 
(and also for output formatting, I don't think <html:style/> should work 
on XML (as it admittedly does in Firefox) since the namespace presumably 
should apply to items in that namespace only, unless perhaps CSS 
namespaces were used). In any case, I still think there is a need for 
<cssStylesheet/> or the like to provide a global stylesheet for 
indicating original formatting.

best wishes,
Brett