Log in

View Full Version : W3C stumper



marain
01-09-2013, 08:56 PM
Hi Folks,

I've managed fairly well on my own for a while, but now find myself stumped over what may be a ridiculously easy question: W3C will not validate the following:


<p title="Unauthorized Practice of Immigration Law">A separate statute devotes itself to unauthorized practice of <i>immigration</i> law. That separate statute is N.J.S. 2C:21-31. As with N.J.S. 2C:21-22, violation of N.J.S. 2C:21-31 can be either a third degree or fourth degree crime, depending on the particular circumstances of the case.</p>

The full page in question is: http://www.marainlaw.com/page.php?here=unauthorizedpractice.

Assistance humbly sought.

Best,

A.

P.S. Happy New Year, all.

Beverleyh
01-09-2013, 09:11 PM
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.marainlaw.com%2Fpage.php%3Fhere%3Dunauthorizedpractice&charset=%28detect+automatically%29&doctype=Inline&group=0&ss=1

According to the source as identified by the validator, you have an <i> and </i> formatting inside of an image tag (in the alt text). Remove those and see how it improves things.

traq
01-09-2013, 09:14 PM
...validate it as what?

and is there a specific error it gives you?


According to the source as identified by the validator, you have an <i> and </i> formatting inside of an image tag (in the alt text)...
actual source code of <p> in question:
<p title="What Constitutes “Unauthorized Practice of Law?”">Determining whether a particular activity constitutes unauthorized practice of law is often difficult. The practice of law encompasses much more than conduct of litigation in the courts. It includes actions for <a href="http://www.marainlaw.com/bottomline.php"><img border="2" src="images/unauth1.jpg" alt="criminal defense lawyer in New Jersey for unauthorized practice of law. Note that an additional New Jersey statute specifically deals with unauthorized practice of <i>immigration law</i>. That statute is N.J.S. 2C:21-31." width="160" height="240" class="left" /></a>which legal knowledge, training, skill and ability are required. Loosely speaking, advice to clients, and all actions taken for them in matters connected with the law, constitute practice of law. That includes work performed outside of a court. It includes actions having no immediate relation to proceedings in court.</p>


A commonly understood textual representation of italicized text is to surround the phrase with underscores, e.g.,
practice of _immigration law_.

molendijk
01-09-2013, 09:56 PM
There's nothing wrong with that line, because this validates (try it):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="Unauthorized Practice Law New Jersey" />
<meta name="classification" content="lawyer, federal, criminal, attorney, NJ, New Jersey, DWI, trial, appeal, juvenile, crime" />
<meta name="extra" content="Counsellors at Law who go that extra mile for their clients." />
<meta name="distribution" content="Global" />
<title></title>
</head>
<body>
<p title="Unauthorized Practice of Immigration Law">A separate statute devotes itself to unauthorized practice of <i>immigration</i> law. That separate statute is N.J.S. 2C:21-31. As with N.J.S. 2C:21-22, violation of N.J.S. 2C:21-31 can be either a third degree or fourth degree crime, depending on the particular circumstances of the case.</p>
</body>
</html>

traq
01-09-2013, 10:26 PM
There's nothing wrong with that line, because this validates...
Correct.

Problem is (as Beverlyh pointed out), the code the OP quoted in their post is only a fragment of a larger document
...and is not the line that is actually producing the validation error.

marain
01-09-2013, 10:29 PM
Beverley, that was it. Thank you!

Seeing the solution, I don't feel quite so inadequate. It does not strike me as that obvious. I salute your acumen.

A.

Beverleyh
01-09-2013, 10:29 PM
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.marainlaw.com%2Fpage.php%3Fhere%3Dunauthorizedpractice&charset=%28detect+automatically%29&doctype=Inline&group=0&ss=1

According to the source as identified by the validator, you have an <i> and </i> formatting inside of an image tag (in the alt text). Remove those and see how it improves things.
Hi again peeps,

Can I just check that we're all talking about the same thing - the img inside of the paragraph that has italic text in the alt value, like this?;
<img border="2" src="images/unauth1.jpg" alt="criminal defense lawyer in New Jersey for unauthorized practice of law. Note that an additional New Jersey statute specifically deals with unauthorized practice of <i>immigration law</i>. That statute is N.J.S. 2C:21-31." width="160" height="240" class="left" /> that's what the validator is flagging on line 57.

Beverleyh
01-09-2013, 10:32 PM
Ha, ha - I've got some serious sausage-fingers going on with this iPhone keyboard. I am so slow tonight - i can't keep up!

Glad you/we got it sorted :)

marain
01-09-2013, 10:32 PM
Hi Traq,

Beverley found the problem. I'm still not quite sure why I can't italicize within alt tags, but so be it.

Best,

A.

traq
01-09-2013, 10:46 PM
I'm still not quite sure why I can't italicize within alt tags, but so be it.

why you can't do it:
Attribute values must be text (not HTML - you can nest elements inside other elements [subject to rules, of course], but not inside a tag - that's what messes up the parser).

why the rules are that way:
Attributes are "metadata," not content: therefore, there are no semantics, nor any reason to apply formatting.

If you want to display an attribute value to the user (and the browser's default formatting does not suit your taste), you need to grab the value via javascript and apply your formatting + presentation that way.

marain
01-10-2013, 12:02 AM
I understand your explanation, and it makes sense. Before you explained it, I tried to reason it out. The best I could come up with was this: The alt attribute is intended for people visually challenged. Since that audience cannot see graphics, they would be all the more unable to perceive italicizing. Therefore the nice people at w3c saw no reason to waste time accommodating an element that served no useful purpose.

djr33
01-10-2013, 12:10 AM
It's much more basic than that.

It's like naming a movie. The name itself isn't red, or in Italics, or size 16 font. When you copyright the movie (or do any other sort of legal process, like filing a patent, naming a product in a lawsuit, etc), the actual words are all that you can use-- the content. Or for naming a person-- you can't name yourself John Doe, in Italics.

In the logo for the film (or anything else I mentioned), it can be formatted-- red size 16 Italics, if you'd like.

HTML is markup, and that's what the tags do-- they mark up the text with formatting. Any of the information inside the tags is just information, never formatting. (They also don't ever layer inside themselves, because it just doesn't really make sense to do it that way, and if they could it would be extremely difficult to parse it!)


I hope I'm not being too repetitive with that; but your reply makes it sound like you still may be wondering, and it's worth understanding that.

By the way, there's an interesting detail to address. Originally there were <i> and <b> tags for italic and bold text. Later they were deprecated and replaced with the <em> and <strong> elements. Why? Actually because of the visually challenged. Having italic or bold text is useless if you can't see it. But having "emphatic" or "strong" text can be conveyed in audio (louder, or perhaps faster, etc.), and that's why the organizational "emphatic" and "strong" options are better than the purely visual "italic" and "bold" options. (Note that you can still use CSS for literal italic and bold text, if it's perhaps to fit with the layout of the page, but not to have meaning.) And in certain specific cases, it might even be still a good idea to use <i> or <b>. The only case I can think of is for citing other sources-- titles (books, movies, etc.) should be italicized. Therefore, you would probably want to use <i>. I doubt that "emphatic" would have any relevance to a bibliographic entry for someone who uses text-to-speech.

marain
01-10-2013, 01:01 AM
Traq, you characterize alt contents as metadata, but my understanding is that search engines treat alt contents as data. In fact, my major motive for inserting alt data in the first place is for the benefit of search engines. If my motive is sound, then it would seem to me that search engines are treating alt contents as data, not metadata.

A.

djr33
01-10-2013, 01:49 AM
"metadata" = information about data.
alt attributes = information about images


They are useful for search engines because they tell the search engine what information (data) is contained in the image-- data about data-- metadata.

traq
01-10-2013, 01:54 AM
Traq, you characterize alt contents as metadata, but my understanding is that search engines treat alt contents as data...

right; data which describes the element it's attached to (which is what "metadata" means).
As Daniel says; "data about data."

To relate this to your case, the alt attribute is supposted to describe the image (e.g., what you would write in place of the image if you wrote a document outline).

If it's intended to be consumed as content, then it shouldn't be in the alt attribute: it should be placed in its own element (HTML5's <figcaption> would be a good choice). Without seeing your image, I'd expect the first part of your alt text ("criminal defense lawyer in New Jersey for unauthorized practice of law.*") to be appropriate, but it seems unlikely that the rest of it is related to the image (itself) at all (unless the lawyer in the photo is literally holding a note describing the law). It would be good as a caption, but the alt attribute is not a caption.

-----
* actually, I think you might mean "criminal defense lawyer specializing in unauthorized practice of law in New Jersey" ...?
The way you have it implies that the lawyer is in New Jersey because he was [or is going to be] practicing law without authorization.