W3C home > Mailing lists > Public > www-style@w3.org > December 2006

Re: Question about linking CSS to XML vocabularies

From: Mike Bremford <mike-css@bfo.co.uk>
Date: Thu, 28 Dec 2006 18:46:29 +0000
Message-Id: <1158A123-E811-4AD6-B409-5AAF838649A5@bfo.co.uk>
To: www-style@w3.org

I may have I've misunderstood your question, but I'll take a shot  
anyway.

Styling of arbitrary XML doesn't require any additional attributes to  
be added. The "#id" and ".class" selectors are just syntactic sugar  
for the attribute selectors "[id=id]" and "[class~=class]" - there is  
nothing special about those attributes in CSS, and they don't need to  
exist in your XML vocabulary. The "style" attribute isn't part of CSS  
- that's an XHTML-specific way of specifying CSS inline.

So given your use-case, if your XML syntax used "foo:name" as an  
identifer rather than "id", you'd need to write your CSS as

    bar[foo|name=myid] { ... }

it's not as pretty as bar#myid, but does an identical job.

Useful? Or did I miss completely?


Cheers... Mike


On 28 Dec 2006, at 14:57, Andrew S. Townley wrote:

>
> Hi,
>
> I've been trying to find an answer to this in the archives, and I  
> think
> I might be getting close, but I wanted to ask before I spent much more
> time going in circles.  What I'm looking for is the current status of
> any efforts to applying CSS to arbitrary XML vocabularies which  
> weren't
> XHTML.
>
> In doing some investigation on this topic, it seems like there is some
> support in CSS3 for dealing with namespaces.  This means that you can
> style elements with basic, typography type styles, but I'm  
> wondering if
> there was already some way to apply specific class/id type styles.
>
> Where I'm going with this is that if you had a CSS engine that  
> could be
> loaded with rules and apply them to a particular document, using the
> namespace support already being proposed for CSS3, wouldn't you
> potentially also need a corresponding CSS XML vocabulary to define the
> necessary attributes, e.g. css:class, css:style and arguably a css:id?
> The down-side is that to take advantage of this with vocabularies  
> which
> were validated, support for these attributes or an open attribute
> content model must be supplied in the schema.
>
> I was wondering if something like this has been discussed before.  If
> I'm on the wrong list, my apologies, but since this is really more  
> of a
> CSS thing than an XML thing, I figured this would be a good place to
> start.
>
> The use case for something like the above CSS XML attribute  
> definitions
> would be if you were dealing with documents of a particular XML
> vocabulary that you wanted to directly incorporate into a hypermedia
> application.  The use of the css: attributes would allow you to be  
> able
> to treat certain elements in the vocabulary with conditional  
> styling as
> the user interacted with the application, e.g. selecting an element  
> from
> a dynamic user interface.  You'd need to dynamically modify the  
> content
> model to add/remove the attribute when the user interacted with the
> application, but I think this would be the best way to accomplish  
> such a
> scenario.
>
> What I'm trying to avoid is transforming the underlying XML vocabulary
> to XHTML for display purposes because I want to preserve the
> vocabulary's semantics within the hypermedia application, but have  
> to do
> as little work as possible to render any given view of a particular
> element.  Maybe the above doesn't really make any sense, but I  
> wanted to
> ask the question before I went off and tried some things along these
> lines.
>
> Thanks in advance,
>
> ast
> -- 
> Andrew S. Townley <ast@atownley.org>
> http://atownley.org
>
>
>
Received on Thursday, 28 December 2006 18:47:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:48 GMT