XHTML strict

J

Jure Erznoznik

I've decided to reprogram my WEB app to XHTML for some of the benefits
described in W3C documentation.
While studying the documentation, I noticed a particular line which said
somethink like: If you wish to separate data from presentation, use strict,
otherwise use transitional.

While my documents work just fine using strict, I'm not really separating
data from presentation. The documents look almost exactly like they looked
in HTML 4.0 transitional I used before.
Q1: The way I understand it, to separate data from presentation, I would
have to use XSLT, wouldn't I?
I really don't want to do this since I have multiple data sets on each page.
I like them separated in the code the way they currently are. I would also
like to eventually support other browsers beside IE 6 and Firefox 1 I am
currently testing for and I really don't think XSLT is the way to do that.

Also, I'm having trouble with validator.w3.org:

Q2: Since it is a multilanguage app, I have all the docs UTF-8 encoded.
UTF-8 kinda requires 3 lead bytes to tell the reader how the file is
encoded, but validator says (error in document) that I should avoid those 3
bytes. I can of course do that, but then I would break UTF-8 rules!?!

Q3: Additionally, I have a problem with tables: I made myself a JavaScript
table object which allows me to interactively show SQL queries in HTML
tables (through some XML / PHP / SOAP). Anyway, for this object to work
correctly, I have to tell it each field's unique value, which I do through a
<TR> attribute "uniqueid". (<tr uniqueid="xxx"><td........</tr>) Of course,
the validator is not particulary happy about this attribute since it is
unknown. Is there any other way to have this information in the table in a
valid form?

Thanks in advance,
Jure
 
M

Mitja

Zivjo :)
I've decided to reprogram my WEB app to XHTML for some of the benefits
described in W3C documentation.
While studying the documentation, I noticed a particular line which said
somethink like: If you wish to separate data from presentation, use
strict, otherwise use transitional.
Perhaps the other way round: if you really don't want to / can't separate
data and style, use transitional. If you want them separated, both
transitional and strict will do, though. It's just that strict more or
less of forces you to do it.
Q1: The way I understand it, to separate data from presentation, I would
have to use XSLT, wouldn't I?
XSLT is a generic style markup language, used for generic XML. You use
XHTML, which is a subset, so css is fine and preferred. (Hm... preffered?
I'm not exactly at home with XML, but I think XSLT isn't even a proper
substitute for CSS. What you can do with XSLT, AFAIK, is transform it into
a (possibly CSS-enhanced) XHTML file).
Q2: Since it is a multilanguage app, I have all the docs UTF-8 encoded.
UTF-8 kinda requires 3 lead bytes to tell the reader how the file is
encoded, but validator says (error in document) that I should avoid
those 3 bytes. I can of course do that, but then I would break UTF-8
rules!?!
Nope, the leading bytes (called byte order mark) are optional for UTF-8:
http://www.unicode.org/faq/utf_bom.html#22
Q3: Additionally, I have a problem with tables: I made myself a
JavaScript table object which allows me to interactively show SQL
queries in HTML
tables (through some XML / PHP / SOAP). Anyway, for this object to work
correctly, I have to tell it each field's unique value, which I do
through a <TR> attribute "uniqueid". (<tr
uniqueid="xxx"><td........</tr>) Of course, the validator is not
particulary happy about this attribute since it is
unknown. Is there any other way to have this information in the table in
a valid form?
Two ways: you can (a) write your own DTD which allows the uniqueid
attribute or, much better, you can (b) use the standard id attribute, as
in <tr id="foo">.

HTH,
Mitja
 
S

Spartanicus

Jure Erznoznik said:
I've decided to reprogram my WEB app to XHTML for some of the benefits
described in W3C documentation.

Make sure you can distinguish the facts from the myths first:
http://www.spartanicus.utvinternet.ie/no-xhtml.htm
While studying the documentation, I noticed a particular line which said
somethink like: If you wish to separate data from presentation, use strict,
otherwise use transitional.

While my documents work just fine using strict, I'm not really separating
data from presentation. The documents look almost exactly like they looked
in HTML 4.0 transitional I used before.
Q1: The way I understand it, to separate data from presentation, I would
have to use XSLT, wouldn't I?

First make sure that you use HTML to correctly structure and
semantically mark up your documents, use CSS for all things
presentational.
Also, I'm having trouble with validator.w3.org:

Q2: Since it is a multilanguage app, I have all the docs UTF-8 encoded.
UTF-8 kinda requires 3 lead bytes to tell the reader how the file is
encoded

Document encoding should be transmitted before the client starts to
receive it, this should be done by sending out the http content-type
header, example: "Content-Type: text/html; charset=utf-8".
Q3: Additionally, I have a problem with tables: I made myself a JavaScript
table object which allows me to interactively show SQL queries in HTML
tables (through some XML / PHP / SOAP).

Javascript should never be relied upon, your solution will fail if js is
not available or not enabled.
 
J

Jure Erznoznik

Zivjo }:))

Q1: As I understand Spartanicus, it seems the data / presentation is meant
in a sense of display properties eg. do everything in css. <table> tag is
not ment as a presentation part, only width attribute is (talking generally,
replace table(data) / width(presentation) with anything).
XSLT is as you said (a transformation of XML to CSS enhanced XHTML). It was
my poor understanding of data / presentation terms that lead to this entire
question.

Q2: Thanks. It's been long since I last read the standard.
Q3: Maybe id attribute will really be fine. I was afraid to use it since it
means quite a lot in the standard itself. I don't think writing my own DTD
would be sane. But that raises another question of what to do when I need
multiple such attributes...

Thanks again,
Jure
 
M

Mitja

Top posting is frowned upon in this NG. Rather than typing Q1, Q2 etc.,
quote the appropriate parts, like so:
Q3: Maybe id attribute will really be fine. I was afraid to use it since
it means quite a lot in the standard itself. I don't think writing my
own DTD would be sane.
Yeah, a custom DTD is a geeky option at best...
But that raises another question of what to do when I need
multiple such attributes...
Then HTML is not suited for it. Let us know more about the background,
about what you want to achieve and how you currently implement it. The
answer will most probably be a slightly different and more elegant
approach avoiding your current problems.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top