Accessibility and Validating LINK tags containing "&"

Discussion in 'HTML' started by Lemming, Oct 19, 2004.

  1. Lemming

    Lemming Guest

    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
    --
    Curiosity *may* have killed Schrodinger's cat.
    Lemming, Oct 19, 2004
    #1
    1. Advertising

  2. Lemming

    Mark Parnell Guest

    On Tue, 19 Oct 2004 23:37:38 +0100, Lemming
    <> declared in alt.html:

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

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    "Never drink rum&coke whilst reading usenet" - rf 2004
    Mark Parnell, Oct 19, 2004
    #2
    1. Advertising

  3. Lemming

    T.J. Guest

    "Lemming" <> wrote in message
    news:...
    > 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
    > --
    > Curiosity *may* have killed Schrodinger's cat.



    Are you missing a ; ?
    T.J., Oct 20, 2004
    #3
  4. Lemming

    Lemming Guest

    On Wed, 20 Oct 2004 08:57:36 +1000, Mark Parnell
    <> wrote:

    >On Tue, 19 Oct 2004 23:37:38 +0100, Lemming
    ><> declared in alt.html:
    >
    >> <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">


    That was spot on ... many thanks.

    Lemming
    --
    Curiosity *may* have killed Schrodinger's cat.
    Lemming, Oct 20, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DC Gringo
    Replies:
    3
    Views:
    6,091
    mikeb
    Aug 19, 2004
  2. Jim Whitehead
    Replies:
    0
    Views:
    354
    Jim Whitehead
    Aug 15, 2003
  3. Thomas Scheffler

    XALAN and &amp; in links

    Thomas Scheffler, Jan 5, 2005, in forum: XML
    Replies:
    0
    Views:
    388
    Thomas Scheffler
    Jan 5, 2005
  4. Tony

    & and &amp;

    Tony, May 4, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    425
    Michael Nemtsev
    May 4, 2007
  5. Versteijn

    TemplateColumn, HyperLink and &Amp

    Versteijn, Oct 20, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    96
    Versteijn
    Oct 20, 2004
Loading...

Share This Page