472,111 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

Tips and advice on converting from HTML 4.01 Trans. to XHTML

I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01
Transitional and CSS compliant, and I'm thinking of converting it into XHTML
to learn a little about it. Which XHTML variant would you recommend? The w3c
HTML validator mentions XHTML 1.0 Transitional, Basic, Strict, and XHTML
1.1. Would I be able to make my existing CSS work in the XHTML page without
modification to the .css file?
Jul 23 '05 #1
29 3687
Armand Karlsen wrote:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML
4.01 Transitional and CSS compliant, and I'm thinking of converting
it into XHTML to learn a little about it. Which XHTML variant would
you recommend? The w3c HTML validator mentions XHTML 1.0
Transitional, Basic, Strict, and XHTML 1.1. Would I be able to make
my existing CSS work in the XHTML page without modification to the
.css file?


HTML Tidy might be of great help to automatically concert your pages. I
suggest XHTML 1 Strict but you may go for something else. If you are
using "transitional" a move to "strict" may cause some headaches now,
but they should be worth it in the long run.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 23 '05 #2
On Mon, 29 Nov 2004, Armand Karlsen wrote:
Subject: Tips and advice on converting from HTML 4.01 Trans. to XHTML


Tip: Don't.
Go to HTML 4.01 Strict if you want to convert something and don't know
what to do else in your spare time.

--
Top-posting.
What's the most irritating thing on Usenet?

Jul 23 '05 #3
"Andreas Prilop" <nh******@rrzn-user.uni-hannover.de> wrote in message
news:Pine.GSO.4.44.0411291621210.3945-100000@s5b004...
On Mon, 29 Nov 2004, Armand Karlsen wrote:
Subject: Tips and advice on converting from HTML 4.01 Trans. to XHTML


Tip: Don't.
Go to HTML 4.01 Strict if you want to convert something and don't know
what to do else in your spare time.


Is converting HTML 4.01 Transitional to XHTML-anything a pain?
Jul 23 '05 #4
On Mon, 29 Nov 2004, Armand Karlsen wrote:
Is converting HTML 4.01 Transitional to XHTML-anything a pain?


I'm sorry - no. Please refer to <news:soc.sexuality.spanking>

Jul 23 '05 #5
Armand Karlsen wrote:
"Andreas Prilop" <nh******@rrzn-user.uni-hannover.de> wrote in message
news:Pine.GSO.4.44.0411291621210.3945-100000@s5b004...
On Mon, 29 Nov 2004, Armand Karlsen wrote:

Subject: Tips and advice on converting from HTML 4.01 Trans. to XHTML
Tip: Don't.
Go to HTML 4.01 Strict if you want to convert something and don't know
what to do else in your spare time.

Is converting HTML 4.01 Transitional to XHTML-anything a pain?


Depends on the quality of your HTML code. It's possible to write code
that is both HTML 4.01 Transitional and XHTML 1.1 compliant (excepting
served media type), if you avoid "empty" elements like <br>, <hr> and so on.

Arbitrary HTML is a pain to convert, yes. Andreas' point is that there
is no benefit in doing so. Convert your code to comply with HTML Strict,
and add some of the XHTML rules in to make for easier transition later:

* all elements in lowercase
* all attributes quoted, even compact ones
* closing tags included for all non-empty elements, even optional ones

--
Mark.
http://tranchant.plus.com/
Jul 23 '05 #6
In our last episode,
<41**********************@news.zen.co.uk>,
the lovely and talented Armand Karlsen
broadcast on comp.infosystems.www.authoring.html:
"Andreas Prilop" <nh******@rrzn-user.uni-hannover.de> wrote in message
news:Pine.GSO.4.44.0411291621210.3945-100000@s5b004...
On Mon, 29 Nov 2004, Armand Karlsen wrote:
> Subject: Tips and advice on converting from HTML 4.01 Trans. to XHTML
Tip: Don't.
Go to HTML 4.01 Strict if you want to convert something and don't know
what to do else in your spare time.

Is converting HTML 4.01 Transitional to XHTML-anything a pain?


No. Tidy can be persuaded to do a pretty good job of converting -
if you have a valid HTML 4.01 * document to begin with. Otherwise:
GIGO.

--
Lars Eighner -finger for geek code- ei*****@io.com http://www.io.com/~eighner/
Nobody home but the lights, and they're out too.
Jul 23 '05 #7
Armand Karlsen wrote:
"Andreas Prilop" <nh******@rrzn-user.uni-hannover.de> wrote in message
news:Pine.GSO.4.44.0411291621210.3945-100000@s5b004...
On Mon, 29 Nov 2004, Armand Karlsen wrote:
Subject: Tips and advice on converting from HTML 4.01 Trans. to
XHTML


Tip: Don't.
Go to HTML 4.01 Strict if you want to convert something and don't
know what to do else in your spare time.


Is converting HTML 4.01 Transitional to XHTML-anything a pain?


HTML Strict -> XHTML Strict = relatively easy (HTML Tidy)
HTML Strict -> XHTML Transitional = relatively easy
HTML Transitional -> XHTML Strict = relatively hard

Then again if you don't know what to gain with XHTML you may want to
simply convert HTML4 Transitional to Strict. That may be hard but will
improve on a site.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 23 '05 #8
Lars Eighner wrote:
Tidy can be persuaded to do a pretty good job of converting -
if you have a valid HTML 4.01 * document to begin with. Otherwise:
GIGO.


Sorry, but that's really misleading to beginners. Tidy HTML is
precisely so useful because it can turn *invalid* documents (garbage)
into *valid* documents (clean stuff). Maybe you are right it cannot
handle *total* chaos, but let's not throw out the baby with the bath
water.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 23 '05 #9
On Mon, 29 Nov 2004, Armand Karlsen wrote:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML
4.01 Transitional and CSS compliant, and I'm thinking of converting
it into XHTML
You need to have a good reason. Most of us don't have, I would
suggest.

I might (just *might*) make an exception for newly-generated content.
to learn a little about it.
Well, maybe. But why? If XML is good for anything, it's because
of a better toolkit. So if you're interested in XHTML, why not
learn something about XML toolkits? There's nothing exciting about
converting old HTML into shiny XHTML.

If you want to do something that -is- worthwhile, then I'd suggest
looking at getting rid of transitional features, and work to Strict.

That could be Strict HTML/4.01 or Strict XHTML/1.0 - whereby HTML
is still slightly more compatible with the existing browser population
that's out there.
Which XHTML variant would you recommend? The w3c
HTML validator mentions XHTML 1.0 Transitional, Basic, Strict,
As I say, it seems to me that the move away from Transitional is more
important and more fundamentally interesting than the rather trivial
move from H/4.01 to X/1.0.
and XHTML 1.1.
But XHTML 1.1 doesn't have any counterpart of XHTML/1.0-Appendix C,
without which, you can't feed it to the widely-used browser-like
operating system component. That makes it of no great practical
interest in WWW terms right now, whatever one may think of the theory.
Would I be able to make my existing CSS work in the XHTML page without
modification to the .css file?


The short answer to that is "yes".

good luck
Jul 23 '05 #10
Alan J. Flavell wrote:
There's nothing exciting about
converting old HTML into shiny XHTML.


I beg to differ. XHTML and XML are buzzwords, and as such they have
their own bonus (aside of any technical side) in larger corporations
with managers and clients present. ;)
PS: I actually do prefer XHTML for technical reasons!

--
Google Blogoscoped
http://blog.outer-court.com
Jul 23 '05 #11
On Mon, 29 Nov 2004, Philipp Lenssen wrote:
Alan J. Flavell wrote:
There's nothing exciting about
converting old HTML into shiny XHTML.
I beg to differ. XHTML and XML are buzzwords, and as such they have
their own bonus (aside of any technical side) in larger corporations
with managers and clients present. ;)


Exciting? "Whaddever turns you on, buddy". SCNR.
PS: I actually do prefer XHTML for technical reasons!


That's what I meant about theory. But I think you'd have to concede
that if you use XHTML to do anything of significance that can't be
done with HTML, then it's of little practical use in the current WWW
environment?

So, by all means go and experiment with what XHTML and friends can do
on the lab bench; by all means compose new documents with XHTML/1.0
Strict for structure, using CSS for presentation (and serve it to the
infamous "operating system component that thinks it's a browser" by
using the provisions of Appendix C); but don't, at this stage, fuss
about converting old HTML stuff into XHTML.

After all, the question asked was not "should I write in XHTML?" but
"should I convert existing stuff into XHTML?". They're rather
different questions, IMHO.
Jul 23 '05 #12
In our last episode, <31*************@uni-berlin.de>, the lovely and
talented Philipp Lenssen broadcast on comp.infosystems.www.authoring.html:
Lars Eighner wrote:
Tidy can be persuaded to do a pretty good job of converting -
if you have a valid HTML 4.01 * document to begin with. Otherwise:
GIGO.

Sorry, but that's really misleading to beginners. Tidy HTML is
precisely so useful because it can turn *invalid* documents (garbage)
into *valid* documents (clean stuff). Maybe you are right it cannot
handle *total* chaos, but let's not throw out the baby with the bath
water.


Tidy is not a real parser. I suggest passing the document through
NSGMLS first, to be sure it is valid HTML*, using Tidy to convert
it and give it the new DOCTYPE, and putting it through NSGMLS again.

Tidy *is* better than nothing, but it is more of a lint than a
validator.

--
Lars Eighner -finger for geek code- ei*****@io.com http://www.io.com/~eighner/
"We have no opinion on your Arab - Arab conflicts, such as your dispute with
Kuwait." -- Bush's Ambassador April Glaspie, giving Saddam Hussein
the greenlight to invade Kuwait.
Jul 23 '05 #13
Armand Karlsen wrote:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML
4.01 Transitional and CSS compliant, and I'm thinking of converting
it into XHTML to learn a little about it. Which XHTML variant would
you recommend? The w3c HTML validator mentions XHTML 1.0
Transitional, Basic, Strict, and XHTML
1.1. Would I be able to make my existing CSS work in the XHTML page
without modification to the .css file?


I've converted my website from HTML4.1 into XHTML with the help of the
HTML-Kit and Tidy.
Downloadable at: www.chami.com
With CSS I had no problems.

--
Regards,

Gerard Schaefers
Voor meer kook- en eetplezier? Kijk hier!
http://www.xs4all.nl/~sjeef/Nederlands/recepten.html
Jul 23 '05 #14
"Armand Karlsen" <ar************@zen.co.uk> wrote in message
news:41**********************@news.zen.co.uk...
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01
Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant would you recommend? The w3c HTML validator mentions XHTML 1.0 Transitional, Basic, Strict, and XHTML
1.1. Would I be able to make my existing CSS work in the XHTML page without modification to the .css file?

For the moment, I'm converting the site to HTML 4.01 Strict, which is a lot
less painful that I thought. I have 2 queries:

- What would be a neat, compliant way of making the headings of the news
entries underlined? Enclosing them in <h1>..</h1> and adding the appropriate
code in CSS should do it, but would the <h1> tag change the size of that
text?

- Is there a compliant method of making a link open in a new window? I know
that some people don't like this and would prefer to do it manually with
Control+Click/shift+Click or whatever, but I'd like a way of opening
external links in a new window.
Jul 23 '05 #15
On Mon, 29 Nov 2004 21:18:39 -0000, Armand Karlsen
<ar************@zen.co.uk> wrote:
- Is there a compliant method of making a link open in a new window? I
know
that some people don't like this and would prefer to do it manually with
Control+Click/shift+Click or whatever, but I'd like a way of opening
external links in a new window.


Why? You know your visitors don't like it, but you, _the_author_, will
still do it to your visitors because you, _the_author_, like it? Makes no
sense to me. If your site is any good, your visitors will be back at your
pages as they wish.
--
Weblog | <http://home.wanadoo.nl/b.de.zoete/_private/weblog.html>
Webontwerp | <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html>
Zweefvliegen | <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
Jul 23 '05 #16
"Barbara de Zoete" <b_********@hotmail.com> wrote in message
news:opsh8wlxgjx5vgts@zoete_b...
On Mon, 29 Nov 2004 21:18:39 -0000, Armand Karlsen
<ar************@zen.co.uk> wrote:
- Is there a compliant method of making a link open in a new window? I
know
that some people don't like this and would prefer to do it manually with
Control+Click/shift+Click or whatever, but I'd like a way of opening
external links in a new window.


Why? You know your visitors don't like it, but you, _the_author_, will
still do it to your visitors because you, _the_author_, like it? Makes no
sense to me. If your site is any good, your visitors will be back at your
pages as they wish.

Fair point. I'll ditch that, then. Going back to the previous query, would
<h1>..</h1> tage change the size of the text within them?
Jul 23 '05 #17
On Mon, 29 Nov 2004 21:32:26 -0000, Armand Karlsen
<ar************@zen.co.uk> wrote:
Going back to the previous query, would
<h1>..</h1> tage change the size of the text within them?

- What would be a neat, compliant way of making the headings of the news
entries underlined? Enclosing them in <h1>..</h1> and adding the
appropriate
code in CSS should do it, but would the <h1> tag change the size of that
text?

is what you asked.

Well, if you do nothing, yes, they would. Generally a graphical UA has a
very distinct appearance for the h1 element.
You could style the element itself in external css. If you put a div
element as a container and give that div an id, like 'entrys', you could
style the h1 for 'entrys' only and thus not effect the h1 in all other
instances.

markup:
<div id="entrys">
<h1>your first entry</h1>
<p>paragraph</p>

<h1>your second entry</h1>
<p>paragraph</p>
</div>

style:
#entrys h1 {
all the styles in here; }

Important notice :-)
==> Having said that: Remember to use the h# elements in hierarchy. Thus a
page has one h1, a few h2's for sub sections, a few h3's for single
important paragraphs for instance, that deserve their own heading. That is
the usual way and semantically correct way to use the h# elements.
--
Weblog | <http://home.wanadoo.nl/b.de.zoete/_private/weblog.html>
Webontwerp | <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html>
Zweefvliegen | <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
Jul 23 '05 #18
in comp.infosystems.www.authoring.html, Armand Karlsen wrote:
"Armand Karlsen" <ar************@zen.co.uk> wrote in message
news:41**********************@news.zen.co.uk...
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01
Transitional and CSS compliant, and I'm thinking of converting it into XHTML
to learn a little about it. Which XHTML variant would you recommend? The

w3c
HTML validator mentions XHTML 1.0 Transitional, Basic, Strict, and XHTML
1.1. Would I be able to make my existing CSS work in the XHTML page

without
modification to the .css file?

For the moment, I'm converting the site to HTML 4.01 Strict, which is a lot
less painful that I thought. I have 2 queries:

- What would be a neat, compliant way of making the headings of the news
entries underlined? Enclosing them in <h1>..</h1> and adding the appropriate
code in CSS should do it, but would the <h1> tag change the size of that
text?


Use Hx elements. You shoudl rethink your markup if you end up with
several h1 elelents.

You also should rethink underlining. In web context, that usually means
link. It is not good idea to confuce people using underline on element
that is not link.

If you don't want font size change, use css: font-size:inherit .
- Is there a compliant method of making a link open in a new window?
No, I hope.
I know that some people don't like this
Do you know someone that likes it? Do you like it on other peoples sites?
and would prefer to do it manually with
Control+Click/shift+Click or whatever, but I'd like a way of opening
external links in a new window.


http://www.karlcore.com/articles/article.php?id=25
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 23 '05 #19
Armand Karlsen wrote:
would <h1>..</h1> tage change the size of the text within them?


Wrong question. First, do the headings warrant heading markup? It sounds
like they do, but without a url, I cannot be sure. If they are headings,
use heading markup. Only after the markup is correct (and validated)
should you start on the visuals.

--
Brian (remove "invalid" to email me)
Jul 23 '05 #20
In article <41**********************@news.zen.co.uk>,
"Armand Karlsen" <ar************@zen.co.uk> writes:
Is converting HTML 4.01 Transitional to XHTML-anything a pain?


No. There are lots of tools that can do it. Or you can write HTML
and have apache convert to XHTML on the fly. Or vice versa.

It makes a tedious task for a human, though.

--
Nick Kew
Jul 23 '05 #21
In article <31*************@uni-berlin.de>,
"Philipp Lenssen" <in**@outer-court.com> writes:
HTML Transitional -> XHTML Strict = relatively hard


Not really. Apache with mod_publisher will do it on-the-fly if you
configure it to use a strict DTD.

--
Nick Kew
Jul 23 '05 #22
"Armand Karlsen" <ar************@zen.co.uk> wrote in message
news:41**********************@news.zen.co.uk...
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01
Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant would you recommend? The w3c HTML validator mentions XHTML 1.0 Transitional, Basic, Strict, and XHTML
1.1. Would I be able to make my existing CSS work in the XHTML page without modification to the .css file?


I have now successfully converted my site to XHTML 1.0 Strict, going via
HTML 4.01 Strict first, as some of you suggested. Thanks for all your help!
Jul 23 '05 #23
Alan J. Flavell wrote:
On Mon, 29 Nov 2004, Armand Karlsen wrote:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML
4.01 Transitional and CSS compliant, and I'm thinking of converting
it into XHTML

You need to have a good reason. Most of us don't have, I would
suggest.

I might (just *might*) make an exception for newly-generated content.


Wow. I think I'm going to print that out and frame it on my wall!

--
Mark.
http://tranchant.plus.com/
Jul 23 '05 #24
Alan J. Flavell wrote:
On Mon, 29 Nov 2004, Philipp Lenssen wrote:
Alan J. Flavell wrote:
There's nothing exciting about
converting old HTML into shiny XHTML.


I beg to differ. XHTML and XML are buzzwords, and as such they have
their own bonus (aside of any technical side) in larger corporations
with managers and clients present. ;)


Exciting? "Whaddever turns you on, buddy". SCNR.


It's not about just me, buzzwords are a group phenomenon...
PS: I actually do prefer XHTML for technical reasons!


That's what I meant about theory. But I think you'd have to concede
that if you use XHTML to do anything of significance that can't be
done with HTML, then it's of little practical use in the current WWW
environment?


To the client side at this moment it does not matter (unless you want
to use stuff that breaks most browsers, such as -- for starters -- a
real XML content-type)... but on the server side, it may or may not be
your preferred way of doing things (it is for me -- I prefer the more
strict syntax, the fact you can very easily use XML snippets and turn
them to XHTML, and so on -- nothing of those reasons which may make
sense for you on your server environment).

--
Google Blogoscoped
http://blog.outer-court.com
Jul 23 '05 #25
Lars Eighner wrote:
Tidy is not a real parser. I suggest passing the document through
NSGMLS first, to be sure it is valid HTML*, using Tidy to convert
it and give it the new DOCTYPE, and putting it through NSGMLS again.


Talking about different parsers, I wonder if PHP5 is using TidyHTML --
because it lets me use dom_load_htmlfile* on any URL and then apply
XPath to this (the original document must not be well-formed or valid
at all, neither be XHTML in the first place).

* http://de.php.net/manual/en/function...adhtmlfile.php
Jul 23 '05 #26
Nick Kew wrote:
In article <31*************@uni-berlin.de>,
"Philipp Lenssen" <in**@outer-court.com> writes:
HTML Transitional -> XHTML Strict = relatively hard

Not really. Apache with mod_publisher will do it on-the-fly if you
configure it to use a strict DTD.


How? What would it change this transitional junk into?

<u><i><b><font size="7" color="red">A BIG RED TITLE!</font></b></i></u>
Jul 23 '05 #27
In article <31*************@uni-berlin.de>,
Leif K-Brooks <eu*****@ecritters.biz> writes:
Not really. Apache with mod_publisher will do it on-the-fly if you
configure it to use a strict DTD.


How? What would it change this transitional junk into?

<u><i><b><font size="7" color="red">A BIG RED TITLE!</font></b></i></u>


Just applying the DTD will strip out the <font> and the <u> (unless <u>
is allowed in strict; can't be arsed to look it up). The text is still
there, and the <i> and <b> - which are perfectly valid strict - are
still there to highlight it.

If you want to *replace* the BIG RED title with, say, <h1 class="bigred">,
or less ambitiously tidy-style lip service to standards with
<span style="font-size: 250%; color: red"> you'd define a macro.
At that point you're into the same complexities as doing it by hand.
But you've already gone beyond what's really necessary. In summary,
the DTD does the important work, while macros deal with presentation
and let you introduce your own heuristics.

--
Nick Kew
Jul 23 '05 #28
Nick Kew wrote:
In article <31*************@uni-berlin.de>,
Leif K-Brooks <eu*****@ecritters.biz> writes:
Not really. Apache with mod_publisher will do it on-the-fly if you
configure it to use a strict DTD.


How? What would it change this transitional junk into?

<u><i><b><font size="7" color="red">A BIG RED
TITLE!</font></b></i></u>


Just applying the DTD will strip out the <font> and the <u> (unless
<u> is allowed in strict; can't be arsed to look it up). The text is
still there, and the <i> and <b> - which are perfectly valid strict -
are still there to highlight it.

If you want to replace the BIG RED title with, say, <h1
class="bigred">, or less ambitiously tidy-style lip service to
standards with <span style="font-size: 250%; color: red"> you'd
define a macro. At that point you're into the same complexities as
doing it by hand.


Exactly. Which is why I said it's *hard*.

You can't *automatically* convert anything purely layout-based into
something entirely semantic/ structural. That only works the other way
round.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 23 '05 #29
On Tue, 30 Nov 2004, Nick Kew wrote:
Just applying the DTD will strip out the <font> and the <u> (unless
<u> is allowed in strict; can't be arsed to look it up). The text
is still there, and the <i> and <b> - which are perfectly valid
strict - are still there to highlight it.
What's basically happening in many of these cases - with respect, and
no offence meant to the original questioner - is that stuff that was
rather obviously of HTML/3.2(spit!) heritage, is being superficially
sanitised as to its syntax, without any attention to the more
interesting part, namely separation of logical concepts from
presentation.
If you want to *replace* the BIG RED title with, say, <h1
class="bigred">, or less ambitiously tidy-style lip service to
standards with <span style="font-size: 250%; color: red"> you'd
define a macro. At that point you're into the same complexities as
doing it by hand.
Of course. One might as well ask how to convert old cheese into fresh
cream. They're both dairy products, after all, so it should be easy
(if we were to accept the analogy of a converter to which one can feed
in tag-soup and get effective XHTML out - they're both products of
pointy-brackets, after all).
But you've already gone beyond what's really necessary.


"Really necessary" by what criteria, though?

all the best
Jul 23 '05 #30

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Krista Bailie | last post: by
5 posts views Thread by lquast | last post: by
1 post views Thread by Donald Firesmith | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.