W3C home > Mailing lists > Public > www-style@w3.org > April 2005

Re: CSS selectors and xml:id

From: Bert Bos <bert@w3.org>
Date: Wed, 27 Apr 2005 22:08:09 +0200
To: Paul Grosso <pgrosso@arbortext.com>
Cc: www-style@w3.org, public-xml-core-wg@w3.org
Message-ID: <20050427200808.GB5592@Candy.local>

On Wed, Apr 27, 2005 at 03:31:21PM -0400, Paul Grosso wrote:
> The xml:id spec [1], authored by the XML Core WG, has 
> gone through Candidate Recommendation, and we are about
> to request it become a Proposed Recommendation.
> Dan Connolly asked in email [2] about whether CSS id 
> selectors [3] will work with uses of xml:id.
> Basically, if someone has:
>   h1#chapter1 { text-align: center }
> then we know that
>   <h1 id="chapter1">A Heading</h1>
> will be centered if id is known to be an ID attribute.
> Once xml:id is a Recommendation, users will also expect
>   <h1 xml:id="chapter1">A Heading</h1>
> to be centered when they are styling XML documents.
> I understand the Amaya browser has just been modified
> to support this, so we do have some evidence of support.
> The XML Core WG would like to know if the CSS WG has 
> any plans in this direction?

Yes, the CSS WG expects ID-selectors to match elements identified with
xml:id. The latest internal draft of CSS 2.1 says this (section 5.9):

    "Document languages may contain attributes that are declared to be
    of type ID. What makes attributes of type ID special is that no
    two such attributes can have the same value; whatever the document
    language, an ID attribute can be used to uniquely identify its
    element. In HTML all ID attributes are named "id"; XML
    applications may name ID attributes differently, but the same
    restriction applies.


    If an element has multiple ID attributes, all of them must be
    treated as IDs for that element for the purposes of the ID
    selector. Such a situation could be reached using mixtures of
    xml:id [XMLID], DOM3 Core [DOM-LEVEL-3-CORE], XML DTDs [XML10] and
    namespace-specific knowledge."

(That last paragraph is not in the public CR of last year, but it will
be in the next one.)

> Specifically, would it make sense for the CSS specification 
> to state explicitly that attributes named xml:id will be 
> treated as IDs when styling XML documents?

I think it is better to keep the language abstract, because there are
no XML formats that allow xml:id yet, let alone formats that are
supported by CSS UAs, so we won't be able to test such a statement.
And that would keep CSS 2.1 from exiting CR.

> paul
> Paul Grosso
> XML Core WG co-chair
> [1] http://www.w3.org/TR/2005/CR-xml-id-20050208/
> [2] http://lists.w3.org/Archives/Public/public-xml-id/2005Apr/0011
> [3] http://www.w3.org/TR/REC-CSS2/selector.html#id-selectors

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 27 April 2005 20:08:19 UTC

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