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

Re: Question about linking CSS to XML vocabularies

From: Andrew S. Townley <ast@atownley.org>
Date: Thu, 28 Dec 2006 19:27:01 +0000
To: Mike Bremford <mike-css@bfo.co.uk>
Cc: www-style@w3.org
Message-Id: <1167334020.9022.169.camel@macross>

Hi Mike,

No, I don't think you misunderstood the question.  I'm just getting
started trying to figure this out, so I didn't realize that the
attribute selectors worked that way.

As for the id, class and style attributes, I realize that they are part
of X/HTML, but I was suggesting that their semantics could be isolated
so they could be used within other vocabularies to support the type of
CSS styling familiar to most users.  I wasn't advocating the use of the
style attribute, but if you were doing the other two, I thought it
should be included as well.  This would also serve to separate
presentation-only attributes from any other attributes within the
vocabulary, which I think would be a good thing.

I'm still not convinced in my own head if xml:id and the id for styling
should be the same or not.  I can see arguments both ways.  For example,
if you were trying to style the first and last elements, you might want
to embed a css:id="first" into your content somehow.  This would be
different than xml:id="first" which might apply to a different scope
that wasn't currently visible due to dynamic manipulation of content

I guess the other question I have if the selectors already exist for
this sort of thing is what implementations of this functionality
currently exist?

Thanks for your help,


On Thu, 2006-12-28 at 18:46, Mike Bremford wrote:
> 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
> >
> >
> >
Andrew S. Townley <ast@atownley.org>
Received on Thursday, 28 December 2006 19:27:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:27 UTC