473,796 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Name attribute for anchor doesn't validate

I have a document with a set of internal links such as:

<a name="Z1"></a>...
<a name="Z2"></a>...

The W3C validator objects to the first instance of the name attribute:
There is no attribute "FOO" for this element (in this HTML
version). The element is defined not to have this attribute.

These anchors are not contained in anything. For example, the Z1
anchor context is actually:

...
</ul>
<hr />
<a name="Z1"></a>
<h2>Title</h2>
<dl>
...

The error is triggered only by the first instance of the name
attribute, and so not by anchors Z2, Z3, ...

My doctype is xhtml11, and my browser is galeon. In my stylesheet,
the a element is defined only with regard to its pseudo-elements.

If I change the first statement to:

<a id="Z1"></a>...

Then the error is triggered by the Z2 anchor, etc.

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05
22 4765
Haines Brown wrote:
Bertilo Wennergren <be******@gmx.n et> writes:
You should know that only a very small minority of users will be
able to see your XHTML 1.1 pages if you serve them correctly (as
"applicatio n/xhtml+xml"). I tested this by replacing "text/html" above with
"applicatio n/xhtml+xml" on a test page rendered by an old IE. It seemed
to render OK. Your remark suggests that it shouldn't have displayed
properly. What am I missing here?
What you write in "meta" elements is more or less irrelevant (for XHTML
1.1). The important thing is what you're server is sending in the actual
HTTP header.

Here's a site where you can check what the browser and the server are
sending to each other behind your back:

<URL:http://webtools.mozill a.org/web-sniffer/>

Very useful!
I serve XHTML 1.1 only to those browsers that claim (in the Accept
header) to be able to handle "applicatio n/xhtml+xml". The others get
XHTML 1.0 served as "text/html". Nice, but could I ask how you do this explicitly?
I do it with PHP. This function returns either "applicatio n/xhtml+xml"
or "text/html":

function ChooseMIME($a,$ u) {
if (substr_count($ u,'Netscape6') > 0 ) $ret = 'text/html';
if (!$ret) {
if (substr_count($ a,'application/xhtml+xml') == 0) {
$ret = 'text/html';
} else {
$xhtml_q = 1;
if
(preg_match("/application\/xhtml\+xml\s*;\ s*q\s*=\s*([\d\.]+)/",
$a,$m)) {
$xhtml_q = $m[1];
}
$html_q = 1;
if (preg_match("/text\/html\s*;\s*q\s* =\s*([\d\.]+)/",
$a,$m)) {
$html_q = $m[1];
}
if ($xhtml_q >= $html_q) $ret = 'application/xhtml+xml';
else $ret = 'text/html';
}
}
return $ret;
}

Call it like this:

$MIMEType = ChooseMIME(strt olower(getenv(' HTTP_ACCEPT')),
getenv('HTTP_US ER_AGENT'));

I make an exception for browsers calling themselves "Netscape 6".
Netscape 6 claims to be able to handle "applicatio n/xhtml+xml",
but actually it can't. Otherwise I go strictly by the Accept
header.
From a practical point of view I could just as well serve them all
XHTML 1.0 as "text/html", but I like being on the bleeding edge. If
you don't have any special reason to use XHTML (1.0 or 1.1), you will
probably be better off using HTML 4.01 Strict.

Are you saying that my current definition above is a "practical"
solution although not meeting W3C suggestions? Is there any reason
then that I should not continue as I have?
If you want to use XHTML, but do not want to serve it as
"applicatio n/xhtml+xml", then you should use XHTML 1.0.

If you're only thinking about what is practical now, then you should
probably use HTML 4.01 Strict.
I find myself on what you call the "bleeding edge" for a different
reason, which is that I generate a lot of docs that I hope will find
future use, but I'll never be able to update. That is, I want the
documents to be as flexible as possible (ie., XML).
Then use XHTML 1.0 Strict. It's XML.
The Internet MIME
type seems a secondary issue, but I remain uncertain whether the
text/html type is wrong in principle but works in practice, and
whether application/xhtml+xml is right in principle, but useless in
practice. I've heard that application/xhtml+xml kills javascript and defeats
google, and so people retreat to text/html.


I'm not sure about Google, but I do believe there are some serious
problems with Javascript and "applicatio n/xhtml+xml" in current
browsers.

--
Bertilo Wennergren <be******@gmx.n et> <http://www.bertilow.co m>

Jul 20 '05 #11
Bertilo Wennergren <be******@gmx.n et> writes:
Then use XHTML 1.0 Strict. It's XML.


To revert from XHTML 1.1, I assume I'd just change:

<?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

to:

<?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN"
"http://www.w3.org/TR/xhtml11/DTD/strict.dtd">

Right?
--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #12
Haines Brown:
Bertilo Wennergren <be******@gmx.n et> writes:
Then use XHTML 1.0 Strict. It's XML.

To revert from XHTML 1.1, I assume I'd just change: <?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> to: <?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN"
"http://www.w3.org/TR/xhtml11/DTD/strict.dtd"> Right?


Formally, yes (I can't think of anything else you'd need to change,
formally). But from a practical point of view (you want the page to work
in current browsers, I suppose), you'd also need to make sure you use
all the compatibility tricks noted here:

<URL:http://www.w3.org/TR/xhtml1/#guidelines>

If you want to serve an XHTML 1.0 page as "text/html" you should follow
those guidelines (writing e.g. "<br />" instead of "<br/>"). Some of
those tricks can be used in XHTML 1.1 as well without breaking any
rules, but some of them can't. So you'll have to do some converting, I'm
afraid.

Note that in "C.8. Fragment Identifiers" of those guidelines, the use of
both "id" and "name" is phrased with a weak "may be supplied", making it
(in my interpretation) not mandatory.

--
Bertilo Wennergren <be******@gmx.n et> <http://www.bertilow.co m>

Jul 20 '05 #13
On Tue, Sep 9, Bertilo Wennergren inscribed on the eternal scroll:
Note that in "C.8. Fragment Identifiers" of those guidelines, the use of
both "id" and "name" is phrased with a weak "may be supplied", making it
(in my interpretation) not mandatory.


Appendix C is not normative anyway. You'd need to look elsewhere to
discern any mandatory requirements. The relevant part for XHTML/1.0
would be http://www.w3.org/TR/xhtml1/#h-4.10 which mandates the use of
id= and allows it (deprecated) to be shadowed by name=

Another relevant normative part would seem to be the HTML4 rules which
limit the syntax of these attributes, i.e
http://www.w3.org/TR/html4/types.html#h-6.2

cheers
Jul 20 '05 #14
Alan J. Flavell:
On Tue, Sep 9, Bertilo Wennergren inscribed on the eternal scroll:
Note that in "C.8. Fragment Identifiers" of those guidelines, the use of
both "id" and "name" is phrased with a weak "may be supplied", making it
(in my interpretation) not mandatory.

Appendix C is not normative anyway.


Indeed. My use of "mandatory" should be taken in the context of wanting
and trying to conform to the text in "XHTML Media Types":

The use of 'text/html' for XHTML SHOULD be limited for the purpose of
rendering on existing HTML user agents, and SHOULD be limited to
[XHTML1] documents which follow the HTML Compatibility Guidelines.

<URL:http://www.w3.org/TR/xhtml-media-types/#media-types>

That document is just a "W3C Note". But many take its advice as a must,
and my comment was made supposing such a context.

If I author documents using only "id" for anchors, I can still claim
that I comply fully with the Compatibility Guidelines - in my meaning.
And I can then use "text/html" with XHTML 1.0, citing the W3C Note as
support.

Other parts of those Guidelines are worded more strongly. If you don't
follow those parts, you can hardly claim to be using those guidelines.

--
Bertilo Wennergren <be******@gmx.n et> <http://www.bertilow.co m>

Jul 20 '05 #15
Haines Brown <br****@hartfor d-hwp.com> writes:
To revert from XHTML 1.1, I assume I'd just change:

<?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

to:

<?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN"
"http://www.w3.org/TR/xhtml11/DTD/strict.dtd">


I should not let this slip by. Although the answer was affirmative to
my question whether the above is correct, it turns out that the URL
was in error. The correct "preface" (as best I can make out--i.e., it
works) should be:

<?xml version ="1.0" standalone="yes " encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

(namespace reference here left out) I added the encoding above in
addition to defining it as follows:

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

because the W3C recommendations for XHTML 1.0 seemed to imply that
having it repeated in both places would reduce browser problems.

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #16
On Tue, Sep 9, Haines Brown inscribed on the eternal scroll:
(namespace reference here left out) I added the encoding above in
addition to defining it as follows:

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

because the W3C recommendations for XHTML 1.0 seemed to imply that
having it repeated in both places would reduce browser problems.


I wouldn't express it that way. The general W3C recommendation, as I
understand it, is the same as it was before: to specify the external
character encoding ("charset") on the HTTP header, where it belongs.

Appendix C (as now amended to take account of this general
recommendation) gives some advice for situations where, for some
reason, that isn't feasible. Then, it recommends defining the
"charset" on the <?xml-thingy (but that's a bad idea in practice, due
to a rather popular browser-like operating system component) for the
benefit of XML, -and- on a meta...charset thingy for compatibility
with HTML. Fair enough, as long as you understand what the parts are
for and why they are where they are. I was just a bit concerned at
the way you'd interpreted these bits of advice: providing the <?xml
thingy to IE, far from "avoiding browser problems", causes quirks mode
i.e re-creates "browser problems" even where there were none before.

all the best
Jul 20 '05 #17
On Wed, 10 Sep 2003 02:14:24 +0200, "Alan J. Flavell"
<fl*****@mail.c ern.ch> wrote:
I was just a bit concerned at
the way you'd interpreted these bits of advice: providing the <?xml
thingy to IE, far from "avoiding browser problems", causes quirks mode
i.e re-creates "browser problems" even where there were none before.


I'd say if an author was so misguided as to give IE a XHTML doctype
when it's an HTML user agent, then the user is almost certainly
wanting quirks mode, since they're almost certainly not using XHTML
for appropriate reasons.

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #18
Jim Ley wrote:

to give IE a XHTML doctype when it's an HTML user agent


<span class="disdain" >sneeze</span>

..disdain:after {content: "bulls***" }

--
Brian
follow the directions in my address to email me

Jul 20 '05 #19
Jim Ley wrote:
give IE a XHTML doctype when it's an HTML user agent


"Almost, but not entirely, totally unlike tea."
Jul 20 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
11388
by: TheKeith | last post by:
I heard that the name attribute is deprecated in html 4.01 strict. Is it recommended that you use the ID attribute for images along with the getElementById method instead of the old way? Thanks.
5
5771
by: Neville310 | last post by:
I have a few questions about the name attributes and href referencing to. Can you declare name attributes for tags other than anchor elements (like div or h2)? The validator keeps returning the following error for HTML 4.0 strict . Line 139, column 12: there is no attribute "NAME" <h2 name="heading">H2 Headline </h2> | You have used the attribute named above in your document, but the document type | you are using does not support...
6
1359
by: Richard | last post by:
<a href="#" name="sample">link 1</a> <a href="#" name="sample">link 2</a> Would this be invalid use of the name? If I wanted to have a function that would be acted upon by detection of the "name", would this happen if all "name"s in a group were the same? I know ID can only be used once per document, what about "name"? If this is invalid, then if I went by a unique ID, such as sample1, sample2, sampl3, is there a way to eliminate the...
4
5038
by: catyionic | last post by:
Greetings: I have numerous links on index.html...example of one..... <A HREF="stage.html#Flash" target="left">Flash</A> It connects to page named stage.html ... which contains... <a name="#FLASH">Flash ...</a></td> It presents the data in the middle of index in an Inline frame. It works real well, looks good, but everytime the link is clicked, the
30
2845
by: Mason A. Clark | last post by:
This seems too simple by I can't find the answer. Must <a name="foo"> be closed with </a> ? Must it have content? W3C says the content cannot be block so what if : <a name="foo"> <h2>Foo Is Good</h2> ( a likely location )
5
1793
by: Alex Maghen | last post by:
The editor says that when using <a name="xyz" />, the "name" element is "obsolete" but it doesn't suggest a replacement. What's wrong with <a name="xyz" /> to set a page anchor?
2
2009
by: TheDrizzle | last post by:
Hey All, I am using ADF UIX, which is a Oracle Framework to develop a web application. It is based off XML and translates the XML to HTML upon execution. The problem I'm having is it is creating some anchors I need to access in JavaScript without a name or ID attribute. There is also no way in the XML i can assign these objects a name or ID. For example, I have this <dateField> xml tag I create. This renders on the HTML page as a input...
6
2311
by: Dick Watson | last post by:
I had a page that works when setup like this: === <form name="frmCalc" action=""> <script type="text/javascript"> function btnCalc_onclick(abc) { return "got here with " + abc; }
3
1459
by: idorjee | last post by:
Hi, Can anyone please tell me if there is a way to hyperlink to a web page which doesn't have the anchor "name" attribute (e.g., <a name="thename">), but has tags such as, <strong>. So, my question is, is it possible to hyperlink to a tag? The only way that I know is the following: <a href="http://thepage.com/example.html#thename">The Web Link</a> Thanks a lot in advance.
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10237
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.