Forum Moderators: open

Message Too Old, No Replies

Where's the "X" in XHTML

         

Lance

5:26 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



If the "X" in XHTML means "Extensible", how exactly do you extend it?
For example, I tried this simple test (which worked in FF and NN but choked IE):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=ISO-8859-1" />
<title>Test</title>

<style type="text/css">

* { COLOR: #00f; }

billy { DISPLAY: block; COLOR: #f00; }

frogs { DISPLAY: block; TEXT-DECORATION: underline; }

spaghetti { DISPLAY: block; FONT-WEIGHT: bold; }

</style>
</head>

<body>

<billy>This is a test.</billy>

<frogs>This is a test.</frogs>

<spaghetti>This is a test.</spaghetti>

</body>
</html>

But of course it didn't validate. That it rendered correctly in FF was a shocker.

The bottom line question is: How do you make it work? How do you "extend" the html?

Thanks,
Lance

moltar

6:18 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have to write your own DTD and define the new tags there.

RonPK

8:15 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With your own DTD you can indeed get the page to validate. However ordinary browsers don't read DTDs, so it won't solve the IE problem.

IMHO the X in XHTML is partly marketing-bloat by the W3C. The major difference with HTML is that XHTML documents should be well formed. XHTML 1.x uses the same elements as HTML, and won't let you define your own stuff.

zooloo

8:21 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



I think it's XML that has custom tags...

zoo

Lance

9:11 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



Yes, XML lets you use what ever tags you can think of. That's what gave me the idea to try the above, since XHTML is supposed to some type of hybrid of XML and HTML. I have no need to make this work, but it certainly would be nice if it did.

Marketing hype, huh?

eXtremely 
Hyped but
Totally
Mediocre
Language

Yeah, maybe...

encyclo

10:53 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First stops to extending XHTML are here:

  • XHTML Modularization - an Overview [w3.org]
  • Modularization of XHTML - W3C Recommendation [w3.org]

    The above links give an overview of how XHTML is being modularized - which is the basis of extending XHTML for yourself.

    You can use standard XHTML notation, and add a custom namespace for your unique tags, and you can also build your own custom DTD or combine XHTML with other languages such as MathML or SVG.

    One important caveat, however: don't expect things to work in IE without a certain amount of work. One way of managing it is to serve

    application/xhtml+xml
    to Mozilla/Opera, and
    text/xml
    to IE and use it as XML. But on the whole, the extensibility is considerably reduced due to browser limitations.

    Try this example of XHTML plus MathML plus SVG [w3.org]:

    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/mathml.xsl"?>
    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"[
    <!ENTITY % MATHML.pref.prefixed "INCLUDE" >
    ]>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
    xmlns:pref="http://www.w3.org/2002/Math/preference"
    pref:renderer="css">
    <head> ... </head>
    <body> ... </body>
    </html>
  • RonPK

    11:31 am on Oct 28, 2004 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    FWIW, I just found that IE5+ does know a <custom [msdn.microsoft.com]> element. However, "There is no public standard that applies to this object."

    Lance

    2:48 pm on Oct 28, 2004 (gmt 0)

    10+ Year Member



    Interesting... Applying that technique to my original example (above) yeilds a page that renders correctly in both FF and IE. Will wonders never cease?


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns:customtag xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/xhtml; charset=ISO-8859-1" />
    <title>Test</title>

    <style type="text/css">
    @media all {
    * { COLOR: #00f; }
    customtag\:billy { DISPLAY: block; COLOR: #f00; }
    customtag\:frogs { DISPLAY: block; TEXT-DECORATION: underline; }
    customtag\:spaghetti { DISPLAY: block; FONT-WEIGHT: bold; }
    }
    </style>

    </head>

    <body>
    <customtag:billy>This is a test.</customtag:billy>
    <customtag:frogs>This is a test.</customtag:frogs>
    <customtag:spaghetti>This is a test.</customtag:spaghetti>

    </body>
    </html>

    Now if there were just some way to get it to validate...

    This quest started when I wanted to define an "<ak>" tag to be used for accesskey since the W3C decided to take <u> away from us. And <span class="accesskey"> seems like a real waste of space for trying to do something so simple.