Webizing XHTML Classes

"Proprietary identifiers can easily be replaced with URIs" [1]. To
test out this theory...

Classes in (X)HTML are very important, as they are the only mechanism
by which one can label a certain group of elements. However, the
identifier used to do so is simply a string, e.g. "myclass". While
that is all well and good for proprietary use, what if I want to
associate a title with it (a la the ERT discussion [2]), or re-use it
elsewhere? Well, all we have to do is Webize [3] it by using a URI for
our string.

How intriguing is this?:-

     <p class="http://infomesh.net/myclass/">Text.</p>

Class is defined as being both a generic "class of element" mechanism,
and a "style hook". If used as the latter, I admit that a URI is a bit
of an annoyance to style (due to the fact that we have to UTF escape),
and that most parsers wont correctly divine how to render it:-

     .http\3A \2F \2F infomesh\2E net\2F myclass\2F
       { font-weight: bold; }

or alternatively and equivalently [4]:-

  .http\00003A\00002F\00002Finfomesh\00002Enet\00002Fmyclass\00002F
    { font-weight: bold; }

But compare these to:-

     .myclass { font-weight: bold; }

So you think that looks better? Well it isn't: ".myclass" can't be
accurately represented as a URI, unless you used the CSS BNF to
convert CSS into XML, and then use XPointer... In other words, it is
not properly grounded in the Web where it could quite easily be.

There are ways around the styling problem:-

     <p class="http://infomesh.net/myclass/">
       <span class="bold">My text.</span>
     </p>

Which will work because any block element can take on an inline
<span>, and any inline element can take on an inline <span>, including
<span>.

Is this Webizing of a class better than using RDF in the document and
XPath? Yes: just try embedding RDF into HTML 4.01, or XHTML 1.0! You
can do it with N3, or by using <link>, or whatever, but it's very
messy. This is very clear and it's first party assertion - no linking
involved.

Hence why bother Webizing class?:-

     Disadvantages:
     - Have to escape the URI in CSS, and,
     - still won't style! (but pages should degrade gracefully
       anyway...)

     Advantages:
     - Well grounded in the Web,
     - unique and universal indicator,
     - can be reused,
     - easy to associate a title with it in RDF or whatever,
     - it can *possibly* be dereferenced to gain more information
       about it,
     - may (one day) style correctly.

But URIs are so long to type, why can't we introduce some namespace
aliasing system? Because that's proprietary: vague URI aliases should
be considered harmful! Dan Connolly came up with this idea for using
URIs in class ages ago in HyperRDF [5], but he uses a slightly
convoluted aliasing technique:-

     1. Declare a head@profile and associate that with a
     head@id (N.B. this is not valid XHTML 1.0)
     2. Associate the same namespace as the profile to a new ID using
     that previous ID (ugh - Dan should have used a different NS)
     3. Declare a link type using one of the rel's in the above to
     allow URIs in classes.

Clearly, this is a rather proprietary method of making a namespace
alias... although I do admit that it almost works (step one is illegal
because <head> doesn't have an ID attribute).
Another point to mention is that relative URIs should be avoided like
the plague, for the same reason that they are deprecated as namespace
URIs.

There are many things that could possibly be investigated using this
approach to classes. What about:-

     <p class=" mailto:class@style.com">Text.</p>

     .mailto\3A class\40 style\2F com { font-weight: bold; }

I'm not exactly sure what that signifies... here we run into some of
the problems with using names and address (URIs/URLs) as identifiers.
Using a URI as a class identifier shouldn't imply anything at all,
it's just a unique string that is a) owned, b) can be reused. It may
be dereferencable, but any processors dereffing a class URI should be
considered proprietary IMHO.

Another caveat: are URIs are opaque strings? In other words, should
one think that just because one uses:-

   http://bold.com/bold-font-style/

as a URI that it will always be rendered as bold? Well technically
this would be a very bad idea, but I suppose it may make fairly good
sense, because the following would be rather illogical:-

     .blue { color: "red"; }

Of course, you might be able to include some RDF in the URL that you
use for the class, and that might help (even if it does imply some
form of dereferencing).

Pragmatism? Well, I'd like to see Charles McCN use this for his
tranformations (if that's possible), and Aaron SW in his RSS Bloggy
thing [6] :-)

Overall then, using a URI for a class is a very good idea IMHO, and
should be encouraged where one uses a class as a generic labelling
mechanism. Even if you are using it for styling, it might become a
useful idea in a couple/few years time. Webize your identifiers!

[1] This is my praphrasing of TimBL's two "0" Axioms of URIs:-

     0: Any resource anywhere can be given a URI
     0a: Any resource of significance should be given a URI.
     - http://www.w3.org/DesignIssues/Axioms

[2] http://www.w3.org/WAI/ER/IG/classuse
[3] http://www.w3.org/DesignIssues/Webize
[4] http://lists.w3.org/Archives/Public/www-style/2001Feb/0105.html
[5] http://www.w3.org/2000/07/hs78/
[6] http://logicerror.com/blogifyYourPage

P.S. I had great fun in determining where I wanted to send this
message... maybe I should have included uri@w3.org and
XHTML-L@yahoogroups.com as well (plus RSS-DEV per Aarons recent
discussion), but that would be one large cross-post... Ah well.

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://webns.net/roughterms/> .
[ :name "Sean B. Palmer" ] :hasHomepage <http://infomesh.net/sbp/> .
<> :exipiry "undetermined - mail the author" .

Received on Monday, 26 February 2001 11:58:49 UTC