Accessibility and Validating LINK tags containing "&"

L

Lemming

Greetings,

Apologies if this is an FAQ.

I'm tearing my hair out trying to get around this one.

I have a site which uses different stylesheets for accessibility than
for "normal" viewing. I don;'t wish to use cookies, and so I'm
passing the stylesheet using a query string. (Actually, it's a tad
more complicated than that; I'm passing the stylesheet to use in an
ampersand, rather than a "proper" query string. this is because I'm
using Apache's RewriteRules to build a query string based on a '/'
separated list in the URL, and tagging the css part at the end.
Anyway ...

Since I'm tryting to code for accessibility, I want to add <LINK> tags
which will be picked up by browsers which can understand them (e.g.
Opera but especially voicereaders such as JAWS).

The LINK tags I am using are of the form:

<link rel="home"
title="Home Page"
href="index.php/home/main&css=accessible" />

Or even:

<link rel="home"
title="Home Page"
href="index.php/home/main&amp;css=accessible" />

When clicked, the RewriteRules change the href to:

http://mysite.com/index.php?page=home&css=accessible

and as far as the browser is concerned, everything is fine and dandy.
However, when I try to validate the page using the W3C validator at
http://validator.w3c.org it chokes on the LINK tag, giving the error
message:

"You have used character data somewhere it is not permitted to
appear. Mistakes that can cause this error include putting text
directly in the body of the document without wrapping it in a
container element (such as a <p>aragraph</p>) or forgetting to quote
an attribute value (where characters such as "%" and "/" are common,
but cannot appear without surrounding quotes)."

I *could* change the method used, e.g. instead of using an & use
another character (such as ".") which isn't required to use an entity
and then change the RewriteRules to convert this to "&", but that
would just confuse the search engines, as they would follow any other
links which specified a different stylesheet. Incidentally, the above
syntax works fine in <A ...> anchor tags, it's only in LINK tags that
it fails.

Can anyone tell me what I'm doing wrong?

TIA,

Lemming
 
M

Mark Parnell

<link rel="home"
title="Home Page"
href="index.php/home/main&amp;css=accessible" /> ....
"You have used character data somewhere it is not permitted to
appear. Mistakes that can cause this error include putting text
directly in the body of the document without wrapping it in a
container element (such as a <p>aragraph</p>) or forgetting to quote
an attribute value (where characters such as "%" and "/" are common,
but cannot appear without surrounding quotes)." ....
Can anyone tell me what I'm doing wrong?

Without a URL, it's hard to say, but chances are you're using XHTML
syntax on an HTML page. Try:

<link rel="home"
title="Home Page"
href="index.php/home/main&amp;css=accessible">
 
T

T.J.

Lemming said:
Greetings,

Apologies if this is an FAQ.

I'm tearing my hair out trying to get around this one.

I have a site which uses different stylesheets for accessibility than
for "normal" viewing. I don;'t wish to use cookies, and so I'm
passing the stylesheet using a query string. (Actually, it's a tad
more complicated than that; I'm passing the stylesheet to use in an
ampersand, rather than a "proper" query string. this is because I'm
using Apache's RewriteRules to build a query string based on a '/'
separated list in the URL, and tagging the css part at the end.
Anyway ...

Since I'm tryting to code for accessibility, I want to add <LINK> tags
which will be picked up by browsers which can understand them (e.g.
Opera but especially voicereaders such as JAWS).

The LINK tags I am using are of the form:

<link rel="home"
title="Home Page"
href="index.php/home/main&css=accessible" />

Or even:

<link rel="home"
title="Home Page"
href="index.php/home/main&amp;css=accessible" />

When clicked, the RewriteRules change the href to:

http://mysite.com/index.php?page=home&css=accessible

and as far as the browser is concerned, everything is fine and dandy.
However, when I try to validate the page using the W3C validator at
http://validator.w3c.org it chokes on the LINK tag, giving the error
message:

"You have used character data somewhere it is not permitted to
appear. Mistakes that can cause this error include putting text
directly in the body of the document without wrapping it in a
container element (such as a <p>aragraph</p>) or forgetting to quote
an attribute value (where characters such as "%" and "/" are common,
but cannot appear without surrounding quotes)."

I *could* change the method used, e.g. instead of using an & use
another character (such as ".") which isn't required to use an entity
and then change the RewriteRules to convert this to "&", but that
would just confuse the search engines, as they would follow any other
links which specified a different stylesheet. Incidentally, the above
syntax works fine in <A ...> anchor tags, it's only in LINK tags that
it fails.

Can anyone tell me what I'm doing wrong?

TIA,

Lemming


Are you missing a ; ?
 
L

Lemming

Without a URL, it's hard to say, but chances are you're using XHTML
syntax on an HTML page. Try:

<link rel="home"
title="Home Page"
href="index.php/home/main&amp;css=accessible">

That was spot on ... many thanks.

Lemming
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top