[WEB4LIB] Re: Hard hyphen and HTML validation

Eric Hellman eric at openly.com
Tue Oct 29 23:39:59 EST 2002


Stacy,

  Have hope and let doom vanish.

The only way to correctly represent the "&" character in an html 
attribute value is to use an  html entity.

In other words, the correct html for a link to your catalog IS
<a 
href="http://www.waldo.msus.edu/cgi-bin/pals-cgi?palsAction=newSearch&amp;setWeb=MCLCAT">catalog</a>

A web browser will parse the html and the value of the href attribute 
will be interpreted correctly as

http://www.waldo.msus.edu/cgi-bin/pals-cgi?palsAction=newSearch&setWeb=MCLCAT

(one of my pet peeves!) If you don't believe me do the experiment, 
your links will not be broken in any browser. (I have seen in our 
logs stupid robots get tripped up by correct html, but the doom 
visited upon these robots is well deserved.)


Eric

At 4:19 PM -0800 10/29/02, Stacy Pober wrote:
>Oops, correcting myself here.  I misspoke:  the line doesn't
>break at an &amp; character. It breaks only with the hyphen or
>the numeric character entity for the hyphen.
>
>As for substituting &amp; for an ampersand, I doubt that would
>make me too happy.  It will make my pages validate without
>warnings, but it would also break a number of important links.
>
>For example, the link to our online catalog is:
>http://www.waldo.msus.edu/cgi-bin/pals-cgi?palsAction=newSearch&setWeb=MCLCAT
>On of our silverplatter databases is:
>http://webspirs.silverplatter.com:8000/waldo?sp.form.first.p=srchmain.htm&sp.dbid.p=S(WN)
>and America: History and Life is:
>http://serials.abc-clio.com/cgi-bin/nph-AppStart.py2.1?_appname=v3&initialdb=AH
>
>We cannot substitute &amp; for THOSE ampersands.
>
>So...as far as I can tell, any pages with those URLs are doomed to
>be 'invalid' as far as most validation services are concerned.
>
>Best,
>Stacy
>
>Stacy Pober wrote:
>>
>>  I knew the character validates as &amp;
>>
>>  However...
>>
>>  The problem is Internet Explorer feels it's proper to do a 'line
>>  break' at a hyphen or &amp; character if the line length works out
>>  just right.
>>
>>  For example, if IE sees that the line length is up, it will break
>>  AFL-CIO
>>  into:
>>  AFL-
>>  CIO
>>
>>  I'm doing a simple text menu.  The menu has with short one or
>>  two word links. One of the links is a relatively short hyphenated
>>  word. I don't want the browser to break that one word onto two
>>  lines. I'm currently using the <nobr> html tag for this, and, while
>>  it causes validation errors, it works okay for all the browsers I've
>>  tried.
>>
>>  I know there must be all kinds of interesting ways to do menus that
>>  would get around this, but I don't want to do fancy stuff for this
>>  particular 'horizontal menu' of links.  It's for a simple,
>>  low-graphics site and I would prefer that it display with reasonable
>>  consistency in everything from v.3 browsers on up.
>>
>>  I just want this one hyphenated word to stay on ONE line.
>>
>>  Someone privately wrote to suggest using a style sheet for this:
>>
>>  <span style="white-space:nowrap;">Haagen-Dazs</span>
>>
>>  I'm considering doing that, but I'm curious which browsers it
>>  will NOT work in.
>>
>>  Thanks,
>>  Stacy
>>
>>  Robert Sullivan wrote:
>>  > > OTOH, I probably shouldn't worry too much about those validation
>>  > > errors.  I have come to the realization that some of our pages
>>  > > will *always* produce coding errors because of ampersands or
>>  > > other unusual characters that are a part of some of our database
>>  > > URL's.
>>  >
>>  > Actually, if you convert & to &amp; they validate properly.  (Thanks to
>>  > Web4Lib for informing me of this.)
>>  >
>>  > Bob Sullivan
>>  > Schenectady County Public Library (NY)  <http://www.scpl.org>
>
>--
>Stacy Pober
>Information Alchemist
>Manhattan College Libraries
>Riverdale, NY 10471
>http://www.manhattan.edu/library/

-- 

Eric Hellman, President                            Openly Informatics, Inc.
eric at openly.com                                    2 Broad St., 2nd Floor
tel 1-973-509-7800 fax 1-734-468-6216              Bloomfield, NJ 07003
http://www.openly.com/1cate/      1 Click Access To Everything



More information about the Web4lib mailing list