XHTML 1.1 and <A> Tag

Discussion in 'HTML' started by Shawn B., May 31, 2004.

  1. Shawn B.

    Shawn B. Guest

    Greetings,

    I hope this it the right group as I couldn't find a more suitable match for
    the question.

    I don't see anywhere in the XHTML 1.1 spec that allows the use of the "name"
    attribute for the <A> tag. We used to use those for anchors but if they
    aren't in the spec, what are we supposed to use to achieve the same effect?


    Thanks,
    Shawn
    Shawn B., May 31, 2004
    #1
    1. Advertising

  2. Shawn B. wrote:
    > I don't see anywhere in the XHTML 1.1 spec that allows the use of the "name"
    > attribute for the <A> tag. We used to use those for anchors but if they
    > aren't in the spec, what are we supposed to use to achieve the same effect?


    Unless you're doing something fancy with MathML or other XML dialects
    mixed with HTML, there's very little reason XHTML 1.1 or even 1.0 over
    HTML 4.01. XHTML doesn't even work in a popular web browser (Internet
    Explorer) without a false mime type.

    But, to answer your question, you use the ID attribute of any element.
    See
    <http://www.w3.org/TR/1999/REC-html401-19991224/struct/global.html#adef-id>.
    Leif K-Brooks, May 31, 2004
    #2
    1. Advertising

  3. Shawn B.

    brucie Guest

    in post: <news:cHyuc.2333$>
    "Shawn B." <> said:

    > I hope this it the right group


    nope. try alt.right

    > I don't see anywhere in the XHTML 1.1 spec that allows the use of the "name"
    > attribute for the <A> tag.


    "name" is icky poo. use id.
    http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-4.10

    --
    b r u c i e
    brucie, May 31, 2004
    #3
  4. Shawn B.

    Shawn B. Guest

    Thanks for both replies... I should have guessed... I saw that in the spec
    (as a part of Common) but I didn't piece it together immediately...


    Thanks,
    Shawn


    "Leif K-Brooks" <> wrote in message
    news:b2zuc.261$...
    > Shawn B. wrote:
    > > I don't see anywhere in the XHTML 1.1 spec that allows the use of the

    "name"
    > > attribute for the <A> tag. We used to use those for anchors but if they
    > > aren't in the spec, what are we supposed to use to achieve the same

    effect?
    >
    > Unless you're doing something fancy with MathML or other XML dialects
    > mixed with HTML, there's very little reason XHTML 1.1 or even 1.0 over
    > HTML 4.01. XHTML doesn't even work in a popular web browser (Internet
    > Explorer) without a false mime type.
    >
    > But, to answer your question, you use the ID attribute of any element.
    > See
    >

    <http://www.w3.org/TR/1999/REC-html401-19991224/struct/global.html#adef-id>.
    Shawn B., May 31, 2004
    #4
  5. In news:,
    brucie <> typed:
    :| in post: <news:cHyuc.2333$>
    :| "Shawn B." <> said:
    :|
    :| > I hope this it the right group
    :|
    :| nope. try alt.right
    :|
    :| > I don't see anywhere in the XHTML 1.1 spec that allows the use of
    :| > the "name" attribute for the <A> tag.
    :|
    :| "name" is icky poo. use id.
    :| http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-4.10
    :|
    :| --
    :| b r u c i e

    also, just cuz I'm a smartass, use lower case <a>

    sorry about that, just got the urge...
    --
    **********
    Stephen
    Stephen T. Fox, May 31, 2004
    #5
  6. Shawn B.

    Geoff Ball Guest

    Leif K-Brooks <> wrote in
    news:b2zuc.261$:

    > XHTML doesn't even work in a popular web browser (Internet
    > Explorer) without a false mime type.


    Yes it does. XHTML 1.0 (all versions) can correctly utilize the text/html
    MIME type.

    Regards,
    Geoff
    Geoff Ball, Jun 1, 2004
    #6
  7. Shawn B.

    Spartanicus Guest

    Geoff Ball <> wrote:

    >> XHTML doesn't even work in a popular web browser (Internet
    >> Explorer) without a false mime type.

    >
    >Yes it does. XHTML 1.0 (all versions) can correctly utilize the text/html
    >MIME type.


    Which is a false mime type.

    --
    Spartanicus
    Spartanicus, Jun 1, 2004
    #7
  8. Shawn B.

    Karl Groves Guest

    "Spartanicus" <> wrote in message
    news:...
    > Geoff Ball <> wrote:
    >
    > >> XHTML doesn't even work in a popular web browser (Internet
    > >> Explorer) without a false mime type.

    > >
    > >Yes it does. XHTML 1.0 (all versions) can correctly utilize the text/html
    > >MIME type.

    >
    > Which is a false mime type.


    Here we go again...

    -Karl
    Karl Groves, Jun 1, 2004
    #8
  9. Shawn B.

    Geoff Ball Guest

    Spartanicus <> wrote in
    news::

    > Geoff Ball <> wrote:
    >
    >>> XHTML doesn't even work in a popular web browser (Internet
    >>> Explorer) without a false mime type.

    >>
    >>Yes it does. XHTML 1.0 (all versions) can correctly utilize the
    >>text/html MIME type.

    >
    > Which is a false mime type.


    text/html is a perfectly valid MIME type.

    <http://www.ietf.org/rfc/rfc2854.txt>

    This document even clarifies that "[XHTML1] defines a profile of use of
    XHTML which is compatible with HTML 4.01 and which may also be labeled as
    text/html."

    <http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/#text-html>

    As stated on this W3C document, "[t]he use of 'text/html' for XHTML should
    be limited for the purpose of rendering on existing HTML user agents." This
    is exactly why I use it, and it is perfectly valid to do so.

    In actuality, I wrote the following to minimize its use:

    <?php

    if ((preg_match("/application\/xhtml\+xml/i", $_SERVER['HTTP_ACCEPT'])) ||
    (preg_match("/version=xhtml11(&[a-z0-9]*|$)/", $_SERVER['QUERY_STRING'])))
    {
    header("Content-Type: application/xhtml+xml;charset=utf-8\n");
    header("Content-Language: en\n\n");
    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC
    \"-//W3C//DTD XHTML 1.1//EN\"
    \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
    }

    else {
    header("Content-Type: text/html;charset=utf-8\n");
    header("Content-Language: en\n\n");
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
    }

    ?>

    The regex for "version=xhtml11" is simply an override; for example, if I
    want to validate my document, I append "?version=xhtml11" onto the URI
    (since the W3C validator doesn't include application/xhtml+xml in its http-
    accept header).

    Regards,
    Geoff
    Geoff Ball, Jun 1, 2004
    #9
  10. Geoff Ball <> writes:

    > text/html is a perfectly valid MIME type.


    [for XHTML]

    > <http://www.ietf.org/rfc/rfc2854.txt>
    >
    > This document even clarifies


    The only major point this informational note happens to clarify is that
    the IETF HTML WG closed in '96.

    > that "[XHTML1] defines a profile of use of
    > XHTML which is compatible with HTML 4.01


    Sure; this so-called compatibility proves that *not* taking W3C specs
    seriously will make your implementations bulletproof forward-compatible
    with any future science fiction prose.

    > In actuality, I wrote the following to minimize its use:


    > if ((preg_match("/application\/xhtml\+xml/i", $_SERVER['HTTP_ACCEPT'])) ||
    > (preg_match("/version=xhtml11(&[a-z0-9]*|$)/", $_SERVER['QUERY_STRING'])))
    > {
    > header("Content-Type: application/xhtml+xml;charset=utf-8\n");


    Kewl. It would never have occurred to me to look up a string using a
    regular expression. But since redundancy at the cost of resources for
    the sake of accomplishing futility seems to be the topic of this
    thread...

    Anyway, I wrote the following:

    if(strpos($_SERVER['HTTP_ACCEPT'],'text/plain'))
    header('Content-Type: text/plain; charset=us-ascii');

    It works!!!


    --
    | ) 111010111011 | http://bednarz.nl/
    -(
    | ) Distribute me: http://binaries.bednarz.nl/mp3/aicha
    Eric B. Bednarz, Jun 2, 2004
    #10
  11. Shawn B.

    brucie Guest

    in post: <news:>
    "Eric B. Bednarz" <> said:

    >> if ((preg_match("/application\/xhtml\+xml/i", $_SERVER['HTTP_ACCEPT'])) ||
    >> (preg_match("/version=xhtml11(&[a-z0-9]*|$)/", $_SERVER['QUERY_STRING'])))
    >> { header("Content-Type: application/xhtml+xml;charset=utf-8\n");


    > Kewl.


    very

    > if(strpos($_SERVER['HTTP_ACCEPT'],'text/plain'))
    > header('Content-Type: text/plain; charset=us-ascii');
    >
    > It works!!!


    it may work but it doesn't look as impressive or pervade the reader with
    awe.

    --
    b r u c i e
    brucie, Jun 2, 2004
    #11
  12. brucie <> writes:

    >> if(strpos($_SERVER['HTTP_ACCEPT'],'text/plain'))
    >> header('Content-Type: text/plain; charset=us-ascii');


    > [...] it doesn't [...] pervade the reader with awe.


    I dunno.

    If that reader announced to prefer text/html it certainly should. :)


    --
    | ) 111010111011 | http://bednarz.nl/
    -(
    | ) Distribute me: http://binaries.bednarz.nl/mp3/aicha
    Eric B. Bednarz, Jun 2, 2004
    #12
  13. Shawn B.

    Spartanicus Guest

    Geoff Ball <> wrote:

    >>>XHTML 1.0 (all versions) can correctly utilize the
    >>>text/html MIME type.

    >>
    >> Which is a false mime type.

    >
    >text/html is a perfectly valid MIME type.


    Validity doesn't come in to it.

    text/*HTML* is a *false* mime type if the document is *XHTML*

    --
    Spartanicus
    Spartanicus, Jun 2, 2004
    #13
  14. Shawn B.

    Andy Dingley Guest

    Spartanicus <> wrote in message news:<>...
    > Geoff Ball <> wrote:


    > >Yes it does. XHTML 1.0 (all versions) can correctly utilize the text/html
    > >MIME type.

    >
    > Which is a false mime type.


    Why ?

    (References please)
    Andy Dingley, Jun 2, 2004
    #14
  15. Shawn B.

    Andy Dingley Guest

    "Shawn B." <> wrote in message news:<cHyuc.2333$>...

    > I don't see anywhere in the XHTML 1.1 spec that allows the use of the "name"
    > attribute for the <A> tag.


    Use XHTML 1.0 Transitional.


    I can think of no good reason to go to 1.1

    I can think of no good reason, other than teaching the completely
    naive, to go for a Strict DTD.

    Many people (myself excluded) claim there is no reason to even go for
    XHTML, rather than a HTML 4.01 DTD.



    We now return you to our scheduled Appendix C flamewar.
    Andy Dingley, Jun 2, 2004
    #15
  16. (Andy Dingley) writes:

    > Many people (myself excluded) claim there is no reason to even go for
    > XHTML, rather than a HTML 4.01 DTD.


    Some people (myself included) claim that there is no reason to go for
    any declaration of a formalised syntax when the end user software
    doesn't care about it anyway, as it is unambiguously the case for
    text/html.

    Having said that, I nearly always do, because it allows me to use SGML
    tools in the authoring process. Well, admittedly I also fear the
    rapidly growing number of half-educated web standards subscribers who
    take any break from playing counterstrike to send your clients a link to
    the W3C validator accompanied with Mabusian prophecies of how their site
    will very soon be like totally not forward compatible and stuff.

    > We now return you to our scheduled Appendix C flamewar.


    There's nothing wrong with Appendix C (of the Jargon File :).


    --
    | ) 111010111011 | http://bednarz.nl/
    -(
    | ) Distribute me: http://binaries.bednarz.nl/mp3/aicha
    Eric B. Bednarz, Jun 2, 2004
    #16
  17. "Andy Dingley" <> wrote in message
    news:...
    > "Shawn B." <> wrote in message

    news:<cHyuc.2333$>...
    >
    > > I don't see anywhere in the XHTML 1.1 spec that allows the use of the

    "name"
    > > attribute for the <A> tag.

    >
    > Use XHTML 1.0 Transitional.


    The "id" attribute is required regardless if XHTML 1.0 Transitional or XHTML
    1.0 Strict DTD are used
    http://www.w3.org/TR/xhtml1/#h-4.2

    Many recommend using both "name" and "id" as attributes.

    Mike
    Michael Dixon, Jun 2, 2004
    #17
  18. Eric B. Bednarz wrote:

    > Kewl. It would never have occurred to me to look up a string using a
    > regular expression.


    Try this with just strpos()...

    function goodbrowser () {

    $ac = strtolower(getenv('HTTP_ACCEPT'));
    $ua = getenv('HTTP_USER_AGENT');

    # Netscape 6 can't properly handle XHTML
    if (substr_count($ua,'Netscape6') > 0 ) { return false; }

    # Wget can (well, it doesn't care!), but doesn't list it
    elseif (substr_count($ua,'Wget') > 0 ) { return true; }

    # Any browsers that don't specificially list XHTML, use HTML
    elseif (substr_count($ac,'application/xhtml+xml') == 0) { return false; }

    # Otherwise we need to compare 'q' values.
    else
    {
    $xhtml_q = 1; $html_q = 1;

    if (preg_match("/application\/xhtml\+xml\s*;[^,]*\bq\s*=\s*([\d\.]+)/",$ac,$m)) { $xhtml_q = $m[1]; }

    if ( preg_match("/text\/html\s*;[^,]*\bq\s*=\s*([\d\.]+)/", $ac, $m)
    || preg_match("/text\/\*\s*;[^,]*\bq\s*=\s*([\d\.]+)/", $ac, $m)
    || preg_match("/\*\/\*\s*;[^,]*\bq\s*=\s*([\d\.]+)/", $ac, $m)
    ) { $html_q = $m[1]; }

    if ($xhtml_q >= $html_q) { return true; }
    else { return false; }
    }
    }


    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
    Toby A Inkster, Jun 2, 2004
    #18
  19. Toby A Inkster <> writes:

    > Try this with just strpos()...


    Oh sure, if you wanted to do something *sensible* with the accept header
    it wouldn't suffice. There was no such attempt in the original code.

    BTW, when I wrote 'It works' I somehow hoped it was self-evident enough
    that a (sensible) accept header of an HTML UA would not (anymore).


    --
    | ) 111010111011 | http://bednarz.nl/
    -(
    | ) Distribute me: http://binaries.bednarz.nl/mp3/aicha
    Eric B. Bednarz, Jun 2, 2004
    #19
  20. Toby A Inkster wrote:

    > function goodbrowser () {
    >


    ....snip...

    > # Wget can (well, it doesn't care!), but doesn't list it
    > elseif (substr_count($ua,'Wget') > 0 ) { return true; }


    Strictly speaking, wget lists *everything*, at least in my copy:

    $ wget http://host/

    Ethereal reports:
    Sent:
    GET / HTTP/1.0
    User-Agent: Wget/1.8.2
    Host: host
    Accept: */*
    ^^^
    Connection: Keep-Alive

    In this case, and in the absence of *either* text/html or
    application/xhtml+xml in the Accept header, it might be wiser to judge
    which of the two is higher "quality", rather than basing it on User-Agent.

    > # Any browsers that don't specificially list XHTML, use HTML
    > elseif (substr_count($ac,'application/xhtml+xml') == 0) { return false; }


    Perhaps:
    /* this could be MUCH more efficient, but it gets the idea across */
    elseif ((substr_count ($ac, 'application/xhtml+xml') == 0) &&
    (substr_count ($ac, 'text/html') > 0)) {
    return false;
    } elseif ((substr_count ($ac, 'application/xhtml+xml') > 0) &&
    (substr_count ($ac, 'text/html') == 0)) {
    return true;
    } elseif ((substr_count ($ac, 'application/xhtml+xml') == 0) &&
    (substr_count ($ac, 'text/html') == 0) &&
    /* should also account for text/*, application/* */
    (substr_count ($ac, '*/*') > 0) {
    return /* whichever is higher quality */;
    }

    > # Otherwise we need to compare 'q' values.
    > else
    > {

    ....snip...

    --
    Some say the Wired doesn't have political borders like the real world,
    but there are far too many nonsense-spouting anarchists or idiots who
    think that pranks are a revolution.
    Owen Jacobson, Jun 3, 2004
    #20
    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. shruds
    Replies:
    1
    Views:
    783
    John C. Bollinger
    Jan 27, 2006
  2. Replies:
    7
    Views:
    884
  3. chronos3d
    Replies:
    9
    Views:
    776
    Andy Dingley
    Dec 5, 2006
  4. Usha2009
    Replies:
    0
    Views:
    1,133
    Usha2009
    Dec 20, 2009
  5. xhtml champs
    Replies:
    0
    Views:
    527
    xhtml champs
    Aug 1, 2011
Loading...

Share This Page