- From: Tim Bagot <tsb@earth.li>
- Date: Sun, 13 Jun 1999 10:41:05 +0000 (UTC)
- To: Style Sheet mailing list <www-style@w3.org>
On Fri, 11 Jun 1999, Tapio Markula wrote: > IE allows to use this style: > <xdc:title style="font-family: sans-serif;"> The style attribute has a special meaning in HTML, but not in XML documents in general. It may be that some software may choose to interpret this attribute as if it were in an HTML document, but such interpretation is certainly not guaranteed. > I tested > <!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd"> > <?xml version="1.0"?> > <?xml-stylesheet href="xml-sheet.css" type="text/css" ?> > <html xmlns="http://www.w3.org/TR/xhtml1" > xmlns:author="xml-dtd.dtd"> > > DTD was defined all new elemets > > BODY > <author:container class="author2"> > <author:nameclass="author">Tapio Markula</author:name></author:container> > > BUT in this case IE 5.0 can't find css to > this: <author:container class="author2"> from xml-sheet.css but it used > definition, which I made to > > <link rel="STYLESHEET" type="text/css" href="sivusto2.css"> This is not the way to attach style sheets to XML documents; it has this functionality only in HTML. This suggests that IE does not provide a particularly good implementation of XML. > According to a worker of Mozilla this is illegal > <author:container class="author2"> It isn't exactly illegal (assuming the class attribute exists in the relevant namespace), but it is unlikely to do what you expect. The class attribute is special for CSS only in HTML documents. In CSS2, you can use attribute matching selectors (e.g. container[class~=author2]). Alternatively, you can put the class attribute in the html namespace (e.g. <author:container html:class="author2">). This does raise an interesting point, though. AFAIAA, the interaction between XML Namespaces and CSS is not defined. Clearly, elements with the same name but in different namespaces should be treated as distinct by the style sheet. Presumably, therefore, CSS element selectors should include namespaces in style sheets applied to documents using them, or else the style rules should apply only to elements in the document's default namespace, if it has one. The former is difficult, since the colon is already used to delimit pseudo-elements and pseudo-classes. Or is it (theoretically) possible to specify a namespace on the xml-stylesheet directive and have it do the Right Thing? I'm not sure that it is. I suspect that XSL is the better choice for XML documents, at least those using namespaces. Tim Bagot
Received on Sunday, 13 June 1999 06:39:49 UTC