XHTML 1.1 and <A> Tag

J

Jukka K. Korpela

Michael Dixon said:
The "id" attribute is required regardless if XHTML 1.0 Transitional
or XHTML 1.0 Strict DTD are used
http://www.w3.org/TR/xhtml1/#h-4.2

You are referring to "4.2. Element and attribute names must be in lower
case", which looks pretty irrelevant to the question. You probably meant
to refer to "4.10 The elements with 'id' and 'name' attributes", which
indeed says:
"In order to ensure that XHTML 1.0 documents are well-structured XML
documents, XHTML 1.0 documents MUST use the id attribute when defining
fragment identifiers on the elements listed above." (= a, applet, form,
frame, iframe, img, and map)

But the entire section 4 is marked "informational", and there is no
normative statement that makes the id attribute required. The statement
quoted above is probably the result of some confusion, since its internal
logic is obscure; "well-structured" is not a normative concept, and the
statement follows one that says "In XML, fragment identifiers are of type
ID, and there can only be a single attribute of type ID per element",
presumably meant to work as an argument for the "requirement" that
follows. There is no "fragment identifier" concept in XML.

Undoubtedly the idea in XHTML 1.0 is that you SHOULD use the id attribute
when defining a potential target for a link and that you MAY additionally
use the name attribute (in elements where it is allowed), which however
is deprecated. This is illogical, since what's the point of allowing
something for compatibility with existing browsers and saying that it
should be avoided? Anyway, XHTML 1.0 does not forbid using the name
attribute, and it does not even forbid using it as the only method of
defining an anchor.
 
A

Andy Dingley

Michael Dixon said:
The "id" attribute is required regardless if XHTML 1.0 Transitional or XHTML
1.0 Strict DTD are used

What?

- "id" is never "required" in XHTML.

- Using id alone will not reliably emulate the <a name=foo >
behaviour of HTML for identifying document fragments within some user
agents (those unaware of id's behaviour). As you say, if you want this
behaviour, then use both attributes in conjunction.


I think a better reference would be:
http://www.w3.org/TR/xhtml1/#C_8
 
M

Michael Dixon

Jukka K. Korpela said:
You are referring to "4.2. Element and attribute names must be in lower
case", which looks pretty irrelevant to the question. You probably meant
to refer to "4.10 The elements with 'id' and 'name' attributes", which
indeed says:
"In order to ensure that XHTML 1.0 documents are well-structured XML
documents, XHTML 1.0 documents MUST use the id attribute when defining
fragment identifiers on the elements listed above." (= a, applet, form,
frame, iframe, img, and map)

I stand corrected. I was indeed referring to "4.10."
But the entire section 4 is marked "informational", and there is no
normative statement that makes the id attribute required. The statement
quoted above is probably the result of some confusion, since its internal
logic is obscure; "well-structured" is not a normative concept, and the
statement follows one that says "In XML, fragment identifiers are of type
ID, and there can only be a single attribute of type ID per element",
presumably meant to work as an argument for the "requirement" that
follows. There is no "fragment identifier" concept in XML.

Undoubtedly the idea in XHTML 1.0 is that you SHOULD use the id attribute
when defining a potential target for a link and that you MAY additionally
use the name attribute (in elements where it is allowed), which however
is deprecated. This is illogical, since what's the point of allowing
something for compatibility with existing browsers and saying that it
should be avoided? Anyway, XHTML 1.0 does not forbid using the name
attribute, and it does not even forbid using it as the only method of
defining an anchor.


Excellent explanation. Thank you for the input. Think I'll slink off in a
corner
now.


Have a nice day.

MIke
 
M

Michael Dixon

Andy Dingley said:
"Michael Dixon" <[email protected]> wrote in message

What?

- "id" is never "required" in XHTML.

I once again stand corrected. (This is getting habit forming)
"Required" was the wrong term indeed.
- Using id alone will not reliably emulate the <a name=foo >
behaviour of HTML for identifying document fragments within some user
agents (those unaware of id's behaviour). As you say, if you want this
behaviour, then use both attributes in conjunction.


I think a better reference would be:
http://www.w3.org/TR/xhtml1/#C_8

As my 'ol pappy' used to say
"Take a fool as he means, not as he says."

That was what I meant to say.

Have to go brush up on
my research skills now

Mike
 
S

Shawn B.

The there are some great explanations, however, if I use the name attribute,
it fails some XHTML compliance checks, but id always passes.

Thanks,
Shawn
 
C

C A Upsdell

Shawn B. said:
The there are some great explanations, however, if I use the name attribute,
it fails some XHTML compliance checks, but id always passes.

As has been pointed out to you, some legacy browsers need name. So drop
back to xHTML 1.0 Transitional and use both if you need to support them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top