Re: Liaison statement on fragment identifiers from Linking WG

HTML WG Comments on "Liaison statement on fragment identifiers from
Linking WG" Tue, 20 April 1999

http://lists.w3.org/Archives/Member/w3c-xml-cg/1999Apr/0061.html

The HTML WG appreciates the input from the Linking WG, and discussed
it fully at our recent FtF. We entered the meeting believing we would
implement the suggested changes.

However after some discussion we came to the realisation that the
suggestions were based on a misunderstanding of the role of XHTML 1.0.

To summarise:

	The intention of XHTML 1.0 is that it is primarily an XML
	application, and should be served as an XML application.

	However, we believe it is desirable that in the short term to
	have a transition period, to ease the transition from HTML to
	XHTML, and to leverage on the preponderance of old-HTML user
	agents being used in the world. Thanks to a quirk in most old
	user agents, if you follow a small number of guidelines you
	can serve the XML version of HTML as (old) HTML to non XML
	user agents.

Since XHTML is principally an XML application, we want to act as far
as possible like a normal XML application. (This is the reason we
thought we would be adopting the Linking WG's suggestions). This
includes using attributes of type ID as targets of fragment
identifiers.

Now, XHTML 1.0 is just an XMLised version of HTML 4.0, as close as
possible to HTML 4.0 taking into account the requirements of XML.

HTML 4.0 allows the use of both NAME (on A elements) and ID (on any
element) as the target for fragment identifiers. Here are some
extracts from the HTML 4 recommendation (http://www.w3.org/TR/REC-html40/):

    7.5.2 Element identifiers: the id and class attributes

    The id attribute has several roles in HTML: 

	 As a style sheet selector. 
	 As a target anchor for hypertext links. 
	 ...

    12.2 The A element 

    name = cdata [CS] 
	 This attribute names the current anchor so that it may be the
	 destination of another link. The value of this attribute must be
	 a unique anchor name. The scope of this name is the current
	 document. Note that this attribute shares the same name space as
	 the id attribute.

    12.2.1 Syntax of anchor names

    An anchor name is the value of either the name or id attribute when
    used in the context of anchors. Anchor names must observe the
    following rules: ...

    12.2.3 Anchors with the id attribute

    The id attribute may be used to create an anchor at the start tag of
    any element (including the A element).

In many ways this is a hack (and probably introduced to allow a
transition to using ID). We regard the NAME attribute of A elements as
a historical anomaly that should be phased out.

Since HTML documents have to be rewritten (or transformed) to put them
in XHTML form anyway, we decided to adhere to XML Linking suggestions
of using ID as targets, and not NAME anymore. However, to aid the
transition process mentioned above, we left NAME in the DTD for
documents that need to be served to old user agents.

Our chief reasons therefore for not adopting the Linking WG's
suggestions are:

	We want to phase NAME out in the longer term. We think that
	fragment identifiers should refer to the ID attribute.

	If something is called ID, it should be of type ID.

	Making NAME to be of type ID, and ID to be of another type
	would break the use of CSS on XHTML documents, and create a
	semantic difference in how CSS works on a document served as
	HTML and XHTML.

This is also the reason we provide a guideline to use both NAME= and
ID= on A elements when you wish to serve XHTML as HTML, to ensure
consistent behaviour across user agents.

Steven Pemberton
May 1999

Received on Wednesday, 12 May 1999 16:30:30 UTC