473,785 Members | 2,282 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 #1
22 4763
Haines Brown:
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.
That's true. So remove the "name" attribute.
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.


Change all of them to "id". There is no "name" attribute for "a"
elements in XHTML 1.1.

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

Jul 20 '05 #2
Haines Brown wrote:
I have a document with a set of internal links such as:

<a name="Z1"></a>...
<a name="Z2"></a>...
Oooh, old style.
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.
The name attribute for anchors was removed in XHTML 1.1
These anchors are not contained in anything.
That's irrelevent.
The error is triggered only by the first instance of the name
attribute, and so not by anchors Z2, Z3, ...
That's for clarity. Duplicate errors are not displayed. (Depending on the
circumstances)
My doctype is xhtml11, and my browser is galeon.
The browser is irrelevent when discussing validation.
In my stylesheet, the a element is defined only with regard to its
pseudo-elements.
Still irrelevent.
If I change the first statement to:

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

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


Of course, its still an error.

You probably want: <h2 id="Z1">Title</h2>

Netscape 4 and other anchient browsers won't support it, if you care about
them go back to XHTML 1.0... or HTML 4.01.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #3
Bertilo Wennergren <be******@gmx.n et> writes:
Haines Brown:
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.


That's true. So remove the "name" attribute.


Bertilo. Interesting. I see the error of my ways. I use as a
reference, Ian Graham's XHTML 1.0, and apparently the name attribute
was OK in XHTML 1.0, and even preferred because supported by older
browsers.

I infer that in XHTML 1.1, the name attribute is no longer valid and
should not be used, even though some older browsers will no longer
understand fractional links.

So, what would you recommend as a good hard copy reference for XHTML
_1.1_?

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

Jul 20 '05 #4
On Sun, 07 Sep 2003 23:43:50 GMT, Haines Brown
<br****@hartfor d-hwp.com> wrote:
I infer that in XHTML 1.1, the name attribute is no longer valid and
should not be used, even though some older browsers will no longer
understand fractional links.
You should not be serving XHTML 1.1 to any old browsers, it is not
allowed to have a text/html mime-type, so they will not be served it
by your server (and if they will they won't know what to do with it)
So, what would you recommend as a good hard copy reference for XHTML
_1.1_?


I wouldn't bother with it, it's highly unlikely enough UA's will come
along to make it worthwhile, wait until XHTML 2.0 or some other rich
semantic html successor comes along.

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

Jul 20 '05 #5
Haines Brown:
I see the error of my ways. I use as a
reference, Ian Graham's XHTML 1.0, and apparently the name attribute
was OK in XHTML 1.0, and even preferred because supported by older
browsers.
It was kept temporarily to make backwards compatible authoring possible
(compatible with old browsers).
I infer that in XHTML 1.1, the name attribute is no longer valid and
should not be used, even though some older browsers will no longer
understand fractional links.
There are very few of them left. I stopped using "name" for anchors a
few months ago. No one has complained yet.
So, what would you recommend as a good hard copy reference for XHTML
_1.1_?


Good question. I don't think there is any good reference that presents
_all_ such changes in XHTML 1.1. I found some of the out only when I
validated my pages. (One surprising difference is that "body" can not be
empty anymore! Make such a page. Mark it as XHTML 1.0 and validate. Then
change to XHTML 1.1 and validate again.)

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 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".
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.

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

Jul 20 '05 #6
I have _not_ set my XHTML pages up correctly according to W3C
suggestions, for I presently have:

<?xml version ="1.0" standalone="yes "?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
...
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

That is, I here define the document as XHTML 1, but its Internet MIME
type as text/html. According to W3C, one "should" _not_ use an
Internet document type definition "text/html" for XHTML
documents. However, the reasons seemed unimportant for me (access to
other namespaces; definition of character set). That is, I assumed I
could get away with it. Was my reasoning incorrect?

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?
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?
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?

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). 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.

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

Jul 20 '05 #7
Haines Brown <br****@hartfor d-hwp.com> writes:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

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?


Mime types specified by <meta http-equiv> get ignored more often. Set
it in the actual headers using .htaccess (if an Apache server) or some
server-side processing.

--
Chris
Jul 20 '05 #8
On Mon, 08 Sep 2003 13:42:32 GMT, Haines Brown
<br****@hartfor d-hwp.com> wrote:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
This isn't where you set the mime-type...
However, the reasons seemed unimportant for me (access to
other namespaces; definition of character set).
You don't get XML rules of character sets if you serve it as
text/html, so that's irrelevant. You should not use multiple
namespaces if you serve it as text/html, they're ignored anyway by all
the tools that process it as text/html - so how can you need them?
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?
You didn't change the mime-type, if you had IE would not have
attempted to render it, you can make IE render it (by telling it the
mime-type of html is application/xhtml+xml) but then it gets a fair
bit wrong, still treats it as tag-soup and breaks text/html pages!

The mime-type is sent in the HTTP headers, not in the document.
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?


Not really, you should serve XHTML 1.0 as application/xhtml+xml, and I
don't see the point in violating shoulds without good reason, serving
XHTML 1.0 is not a good reason, HTML 4.01 is the same.
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.
HTML 4.01strict served as text/html is certainly your best approach
then, application/xhtml+xml is so rarely used I can certainly forsee
XHTML 2.0 only user-agents existing not caring a jot about the tiny
minority of XHTML 1.* docs around. HTML 4.01 support will be more
likely to continue, and if it doesn't then there's more likelyhood it
will be converted to some other format later in the day. HTML 4.01 ->
XHTML apache modules exist today for example, and there's a huge
legacy HTML rump of data that will need the treatment.
I've heard that application/xhtml+xml kills javascript and defeats
google, and so people retreat to text/html.


Yes, people have all sorts of good justifications for violating
recommendations , but the more they abuse it, the worse the situations
get.

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

Jul 20 '05 #9
On Mon, Sep 8, Chris Morris inscribed on the eternal scroll:
Mime types specified by <meta http-equiv> get ignored more often.
I should certainly hope so: RFC2616 mandates that the HTTP-supplied
value is authoritative.

[Sure, IE rules itself out as a WWW browser (not only) on this
requirement; but in the present context it makes no difference, since
IE dreams-up its bogus information from quite different sources.

And note that trying to mess with "charset" via meta http-equiv comes
too late for XML. In this case it didn't matter, since the meta was
only confirming what XML would have already decided anyway.
Set it in the actual headers using .htaccess (if an Apache server)
or some server-side processing.


Indeed.
Jul 20 '05 #10

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

Similar topics

21
11387
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
1358
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
2310
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
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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
10097
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
9957
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...
1
7505
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
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
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...
3
2887
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.