52 posts tagged “xhtml”
2003
XHTML and Accessibility in ASP.NET Whidbey (via) A definite improvement, but __VIEWSTATE still gives me the willies
Using XPath to mine XHTML
This morning, I finally decided to install libxml2 and see what all the fuss was about, in particular with respect to XPath. What followed is best described as an enlightening experience.
[... 576 words]XHTML for future-proof content
Don Park questions the benefits of emitting XHTML. In one sense, Don is right; publishing a whole site using XHTML in this day and age brings very little benefit and can cause a great deal of grief. But just because XHTML doesn’t provide advantages when publishing whole sites does not mean it should be written off entirely. As I’ve said on this blog many times before, XHTML offers an excellent format for future-proofing site content, especially chunks of content kept in a database. Keith D. Robinson makes some excellent points along the same lines in his latest essay, Standards, Semantic Markup, Distributed Authorship and Knowledge Management:
[... 299 words]Accessing cookies with application/xml+xhtml
I’m completely stuck on this one. When serving XHTML documents to Mozilla as application/xml+xhtml
, the available DOM is for an XML document rather than an HTML document. This means it’s missing the document.cookie object normally used to access cookies from Javascript. I can’t figure out how you access cookies without it (I’ve searched Bugzilla to no avail). Anyone got any ideas? I sure wish the Mozilla project provided better documentation on this stuff.
PyMeld
PyMeld is a concrete implementation of something I’ve been thinking about for months: A template system that takes an XHTML page as a template and manipulates it based on cloning and modifying elements within the template identified using their ID attribute. It’s a very elegant solution that makes good use of Python’s object overloading support to make manipulating templates as intuitive as possible. Maybe the same thing will be possible in PHP once the new overloading functions become part of the standard package.
[... 180 words]Living on a knife edge
In The XHTML 100, Evan Goer describes an experiment in which he checked 119 site claiming to be with an XHTML doctype for full compliance with the W3C standards. His test consisted of three parts—a validation check on the front page, a check on another “inside” page, and a check to see if the correct Content-Type header (application/xhtml+xml
) was served to supporting User Agents (in his case Mozilla 1.3).
XHTML Tips
Via the XHTML-L mailing list, Simon St.Laurent’s XHTML tips archive. An abundance of useful XHTML related information.
Sitepoint XHTML tutorial
SitePoint are running an excellent new tutorial series: XHTML Web Design for Beginners. There’s little there for non-beginnners, but I’ll certainly be sending new learners in that direction.
XHTML is still great for content
In response to Mark Pilgrim’s Poisoning the envelope, Brian Donovan has expanded upon his opinion that long term web facing content should not be stored as (X)HTML:
[... 317 words]XHTML is just fine
In Who dropped the deat cat into the well? (via Mark Pilgrim), Brian Donovan argues that keeping web site content in (X)HTML is a fundamentally bad idea. I thoroughly disagree. When I started this weblog, I realised I needed a format for storing my entries that would keep my content “free” to be reused in multiple different ways. I thought about a simple UBB style markup language, with [url="http://www.example.com/"]links like this[/url]
, automatic line breaks and a few other simple structures such as lists and headings. I also considered Wiki markup of some sort, again looking for a reasonable expressive but controlled markup vocabulary for storing my blog entries in a reusable way.
2002
Syndicating blogs with XHTML
Anil Dash suggests using structured XHTML as a blog syndication format. Scott Andrew points out that this has semantic problems in that it would mean using the class attribute to add additional meaning to a document. I was going to say that this would be an ideal opportunity to mix different namespaces in one XML document (as described by Lachlan Cannon) but techno-weenie beat me to it.
Polluting the web
Hixie and Aaron Swartz are debating Hixie’s infamous Sending XHTML as text/html Considered Harmful on a W3C mailing list. While I am just as guilty of sending XHTML as text/html as anyone else (I’ve been meaning to fix this for a while but just haven’t found time yet) I’ll stick in an argument that Hixie hasn’t used yet. Sending XHTML as text/html basically amounts to pollution of the web. As far as the XML user agents of the future are concerned (which are supposedly one of the main reasons we use XHTML) an invalid XHTML document is unparseable and thus unreadable. Anyone who has tried to keep an XHTML blog valid will know how difficult it is to keep it that way, and without a browser refusing to display the document (as happened with Mozilla and diveintomark the other day thanks to an XML content type and a missing end tag) it can be all to easy to contribute to the pollution. As it stands, a massive proportion of the supposedly XHTML web may as well be just so many random floating bytes.
Hixie on XHTML
Ian Hickson: Sending XHTML as text/html Considered Harmful. Ian makes an excellent case for sticking with HTML 4.01 rather than upgrading to XHTML. Here’s the killer point (at least for me):
[... 193 words]Benefits of XHTML
Phil Ringnalda is questioning the point of XHTML. The single, huge advantage it has over HTML is that XHTML can be parsed by anything (or any language) with an XML parser. As an example, a few weeks ago I was asked to write a script to grab links from a bunch of HTML pages and insert them in to a database. I solved the problem with a combination of PHP’s strip_tags() function and XML parsing abilities, by killing off every tag that wasn’t an <a> tag and slapping on a start and end element to turn the document in to valid XML—a step that would not have been necessary had the page used XHTML in the first place.
[... 190 words]XHTML 2 demonstrated
Sjoerd Visscher has published an XHTML 2.0 page that works in IE6, Mozilla and Opera, complete with support for navigation lists and href
attributes on multiple elements. The implementation is very clever—it uses IE behaviors, Mozilla XBL files and Opera’s proprietary link CSS properties to get all three browsers to play nicely (be sure to check out the style sheet). A custom DOCTYPE at the top of the page adds DTD descriptions of the new XHTML 2.0 elements used in the document.
More on XHTML
A few more notes on XHTML 2.0. Tom Gilder (who incidentally has written an excellent series of tips on accessible scripting) has pointed out that the <dfn>
tag is part of HTML4 and corrected my spelling of draft as well :) Meanwhile, a post by Shane P. McCarron to XHTML-L has highlighted a few more interesting points—<applet>
is out (in favour of <object>
, XMLEvents are in to replace the current event model and the href
attribute can now be used on pretty much anything to turn it in to a link. Strangely XLink is not mentioned in the specification.
XHTML 2
The W3C have published a working draught of XHTML 2.0. Since the Changes from XHTML 1.1 pages doesn’t appear to have been written yet, here are a few of the most notable differences I’ve spotted so far:
[... 116 words]XHTML 1.1 Woes
Tim Luoma on thelist poined out this table, which details the media types that can be used when serving XHTML documents. The table shows that XHTML 1.1 should not be served with a text/html
Content-Type header. Unfortunately using any of the allowed headers (application/xhtml+xml
, application/xml
or text/xml
) will cause Netscape 4 to pop up a “download file” dialog, and is likely to cause problems in other older browsers as well. Looks like I’ll be sticking with XHTML 1.0 Strict for a good while to come. I don’t really understand the hurry to move to XHTML 1.1 exhibited by some developers—to my mind, the single biggest advantage of XHTML is the fact that it allows documents to be parsed by any XML parsing tool, and this benefit is available in XHTML 1.0.
XHTML ODP attribution
The ODP require you to display an attribution on any page that reuses ODP data. The recommended attribution fails to validate as XHTML, so I created an XHTML compliant alternative which looks visually identical (at least in standards compliant browsers) but uses <div>
s with CSS styles. ODP editor in chief rdkeating25 has informally approved my alternative version on the ODP editor forums so I’m ready to go—at least as soon as I finish writing a script to parse data from their pages ;)
XHTML nested lists
Things I learnt today part one: Nested lists in XHTML are possible, but you can’t just put a list inside another list. You have to nest the nested list in a list item. References: W3Schools XHTML differences and the www-html mailing list.
XHTML list
I’ve signed up for a new mailing list (probably not a good idea, I’m getting over 200 mails a day which isn’t much fun on a modem)—XHTML-L, which describes itself as A forum for discussing XHTML issues for both XML and HTML developers
. The list is adminned by Simon St. Laurent, who coincidentally is involved with the SIG-XML project I mentioned earlier today.
My first XHTML mind bomb
I’ve been looking at PHP’s XML handling functions (in particular the xml_parse()
function) and I’ve suddenly realised the advantages of writing entries in valid XHTML. Before I started this blog one of the features I considered adding was something that can pull all of the links out of an entry when it is submitted and index them or add them to a directory somewhere. I was preparing myself for some regular expression hacking, but thanks to XHTML this is now completely unnecessary. All I need to do is define a couple of handlers to deal with <a> tags and Expat will do the hard work for me. In fact, this approach gives me a great deal of flexibility in what I do with my entries. I can extract quotes and blockquotes, pick up on emphasized text and generally allow my blog software to “understand” my entries as and when I add them. The true benefits of XHTML have suddenly become clear.