473,545 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to switch on Standards-compliant mode for IE6 when using thetrick w3 provided for serving xhtml as application/xml to IE

http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml
webpage to IE as application/xml

I used that trick and now every one of my xhtml webpage have following
first 4 starting lines:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="curseIE.x sl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

The second line is used to tell Internet Explorer to treat this page as
html, as a workaroudn suggested by w3.org (curseIE.xsl is a file in the
same directory).

however now the page is rendered in BackCompat mode. I don't understand.
Because a lot of layout is already designed with CSS box model in mind, I
need IE to render it in the Standards-compliant mode ("Standards-compliant
mode" is the terminology used by MSDN I just copy it over). As stated in
this MSDN article:
http://msdn.microsoft.com/workshop/a...ts/doctype.asp
The standard compliant mode is switched on if DOCTYPE is XHTML (which is
true for my webpages)

I also read that some people suggest not to put <?xml ...?as the first
line because that makes IE switch off Standards-compliant mode. Well, so I
removed <?xml ... ?>, result? Standards-compliant mode is still switched
off, tested by using
javascript:aler t(document.comp atMode);

So is it possible at all to use w3's trick to server xhtml to IE and at
the same time make the page render in Standards-compliant mode?

Thanks a lot in advance!
Jan 23 '07 #1
15 4324
Zhang Weiwu wrote:
http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml
webpage to IE as application/xml

I used that trick and now every one of my xhtml webpage have following
first 4 starting lines:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="curseIE.x sl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

So is it possible at all to use w3's trick to server xhtml to IE and at
the same time make the page render in Standards-compliant mode?
Try the proper Doctype:

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

--
Gus
Jan 23 '07 #2

Zhang Weiwu wrote:
http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml
webpage to IE as application/xml
There are three ways to serve XHTML to IE

1. Use HTML instead ! (best)

2. Appendix C of the W3C XHTML 1.0 specification (as Gus described, a
usable choice)
- Use XHTML 1.0 Strict
- Send a text/html content-type header, not an XML content type
- Make sure the doctype declaration is the first content in the
document, without any XML prolog or XSLT stylesheet reference.

3. Send XML and XSLT (As the W3C described on the page you cited, not a
good choice)
This has little to do with HTML, you're sending an XML document and
turning it into HTML at the client-side. The fact that it was already
XHTML to begin with doesn't matter, although it does make the XSLT
stylesheet simple.
To get 3. to work in standards rendering mode, then you need to make
sure the output of the XSLT transform has an appropriate doctype. Use
the <xsl:outputelem ent like this:

<xsl:output method="html"
omit-xml-declaration = "yes"
standalone = "yes"
doctype-public = "-//W3C//DTD HTML 4.01 Strict//EN"
doctype-system = "http://www.w3.org/TR/html4/strict.dtd"
cdata-section-elements = "script pre"
media-type = "text/html"
/>

Jan 23 '07 #3
于 Mon, 22 Jan 2007 22:24:31 -0500,Gus Richterå†™åˆ°ï¼ š
Zhang Weiwu wrote:
>http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml
webpage to IE as application/xml

I used that trick and now every one of my xhtml webpage have following
first 4 starting lines:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="curseIE.x sl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

So is it possible at all to use w3's trick to server xhtml to IE and at
the same time make the page render in Standards-compliant mode?

Try the proper Doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
I cannot. That makes all user of my site rely on their connectivity to
w3.org to see MY website. Due to ISP competition (not competing by
providing better access but competing by block other ISP's access) a lot
of Chinese users especially some college students cannot access w3.org
reasonably fast. Now we got a Taiwan earthquake, impossible to fetch this
DTD file for 99% users.
Jan 23 '07 #4
Scripsit Zhang Weiwu:
>Try the proper Doctype:

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

I cannot.
Yes you can. Besides, it's what you _must_ do in order to conform to the
XHTML specification (when using Strict, but other DOCTYPE alternatives
require the URL as well). Actually you should use HTML 4.01 instead of XHTML
1.0, but that's not relevant here - HTML 4.01 has exactly the same
"problem".

(And you _can_ trim quotations so that you only quote the relevant part in
the message you are commenting on. Please do so in future.)
That makes all user of my site rely on their connectivity to
w3.org to see MY website.
Of course not. Browsers don't actually _use_ DOCTYPE declarations for
anything else than making their guess on whether the author wants "standards
mode" or "quirks mode".

Just try it. You can even put www.w3.invalid instead of www.w3.org and
browsers won't still notice anything, beyond (perhaps) switching to "quirks
mode" (since the DOCTYPE declaration as a _string_ isn't in their list of
alternatives that trigger "standards" mode).

Besides, even if browsers actually tried to fetch the DTD, they would be
expected to use the first quoted string to find it in their catalog and only
failing that should they use the second quoted string as a URL. Thus, in
this hypothetical situation, the URL string could only help, not hurt.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jan 23 '07 #5
于 Tue, 23 Jan 2007 02:08:35 -0800,Andy Dingleyå†™åˆ°ï¼ š
Zhang Weiwu wrote:
>http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml
webpage to IE as application/xml

There are three ways to serve XHTML to IE

1. Use HTML instead ! (best)
Now I know I should not use XHTML but it's too late already. I am already
warned only "advanced user" will be able to use xhtml, but I *thought* I
am an advanced user (4 year Linux user and 3 year apache admin). Now I
think the trouble doesn't worth... I should have used HTML!
>
2. Appendix C of the W3C XHTML 1.0 specification (as Gus described, a
usable choice)
- Use XHTML 1.0 Strict
- Send a text/html content-type header, not an XML content type
- Make sure the doctype declaration is the first content in the
document, without any XML prolog or XSLT stylesheet reference.
This is the idea I like most, but for my limited apache knowledge I think
this is not possible to activate content negociation for IE unless I
create a .html symbolic link to all my .xhtml files (content negociation
is based on file extension name difference), which is not very practical in
my case (I can certainly do it as a last resort). I knew many php methods
but the current website is all about static pages and perhaps will go on
like this.
>
3. Send XML and XSLT (As the W3C described on the page you cited, not a
good choice)
This has little to do with HTML, you're sending an XML document and
turning it into HTML at the client-side. The fact that it was already
XHTML to begin with doesn't matter, although it does make the XSLT
stylesheet simple.
To get 3. to work in standards rendering mode, then you need to make
sure the output of the XSLT transform has an appropriate doctype. Use
the <xsl:outputelem ent like this:

<xsl:output method="html"
omit-xml-declaration = "yes"
standalone = "yes"
doctype-public = "-//W3C//DTD HTML 4.01 Strict//EN"
doctype-system = "http://www.w3.org/TR/html4/strict.dtd"
cdata-section-elements = "script pre"
media-type = "text/html"
/>
Thank you a lot for this detailed answer. I hope someone can add this to
teh FAQ of w3 too so that less people are confused. This is currently the
best solution to static xhtml pages.
Jan 23 '07 #6
于 Tue, 23 Jan 2007 17:12:07 +0200,Jukka K. Korpelaå†™åˆ°ï¼ š
[snip]
>That makes all user of my site rely on their connectivity to
w3.org to see MY website.

Of course not. Browsers don't actually _use_ DOCTYPE declarations for
anything else than making their guess on whether the author wants "standards
mode" or "quirks mode".
Please just try it. You already knew the context, that I am trying to ship
xml document to IE and rely on it to treat it as purely xml, call up a XSL
translation and generate an HTML. You knew this context, so it's clear IE
will try to fetch the DTD file (and ent files refered from DTD file). I
have tried it and you can try it too.

I knew browser is expected to not to actually USE doctype declaration, but
does IE often do things you expected? I am surprised to find I must keep
the dtd files on my webserver, too. Acutally browsers should understand
application/xhtml+xml saving all the trouble here but that's IE I am
talking about. (I knew IE never said they support XHTML too.)
Just try it. You can even put www.w3.invalid instead of www.w3.org and
browsers won't still notice anything, beyond (perhaps) switching to "quirks
mode" (since the DOCTYPE declaration as a _string_ isn't in their list of
alternatives that trigger "standards" mode).

Besides, even if browsers actually tried to fetch the DTD, they would be
expected to use the first quoted string to find it in their catalog and only
failing that should they use the second quoted string as a URL. Thus, in
this hypothetical situation, the URL string could only help, not hurt.
I didn't image this problem, I met this problem. I cannot access my own
website myself in the same office if I keep the correct DOCTYPE
decoration, and I had to ask a friend in German to mail me the DTD fiile
and ent files referred from the DTD file. And since I have been doing web
development for some time, I am getting used to try not to do things the
'correct' way but just do whatever makes IE work.
Jan 23 '07 #7

Zhang Weiwu wrote:
1. Use HTML instead ! (best)

Now I know I should not use XHTML but it's too late already. I am already
warned only "advanced user" will be able to use xhtml, but I *thought* I
am an advanced user
I'm sure that you can use it. The problem is if your users and browsers
can use it. It's just a nuisance to get things right so that they do
work and HTML is easier than Appendix C.

2. Appendix C of the W3C XHTML 1.0 specification
This is the idea I like most, but for my limited apache knowledge I think
this is not possible to activate content negociation for IE
You don't need any negotiation, just serve Appendix C to all browsers.
It works fine.

Jan 23 '07 #8
Zhang Weiwu wrote:
于 Tue, 23 Jan 2007 17:12:07 +0200,Jukka K. Korpelaå†™åˆ°ï¼ š
I didn't image this problem, I met this problem. I cannot access my own
website myself in the same office if I keep the correct DOCTYPE
decoration, and I had to ask a friend in German to mail me the DTD fiile
and ent files referred from the DTD file. And since I have been doing web
development for some time, I am getting used to try not to do things the
'correct' way but just do whatever makes IE work.
Even so, you probably still need to use an absolute URL beginning with
"http://". Have you tried that?
Jan 23 '07 #9
Scripsit Zhang Weiwu:
Please just try it. You already knew the context, that I am trying to
ship xml document to IE and rely on it to treat it as purely xml,
call up a XSL translation and generate an HTML.
OK, sorry, I lost the context and though about normal HTML processing in
browsers. Indeed, if you serve your data as XML and include a DOCTYPE
declaration, then browsers _may_ (and often do) retrieve the DTD.
I knew browser is expected to not to actually USE doctype
declaration, but does IE often do things you expected?
Actually browsers _are_ more or less expected to use it in XML context and
would be expected to do so in genuine SGML context, but HTML never was
genuine SGML.
I am surprised
to find I must keep the dtd files on my webserver, too.
Well, that's a different issue and a browser fault, but actually the XHTML
specifications tell you to use a DOCTYPE declaration with a URL. If you
serve an HTML document as application/xml, just referring to the XHTML
"namespace" , then you're more or less in a no-man's land between HTML and
generic XML.
And since I have been
doing web development for some time, I am getting used to try not to
do things the 'correct' way but just do whatever makes IE work.
The way that has worked for years and will keep working indefinitely is to
use HTML 4.01. There's no hurry in moving to XHTML at least before IE does.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jan 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3607
by: David Inada | last post by:
Looking for any info on coding standards for ASP? Any tools that help with the review/formatting of code? Is it done mainly for the jscript/vbscript components? David
16
2215
by: Braxton Beyer | last post by:
I have just added a message to my website, wellheard.com, notifying WinIE users that their browsers will not render the site correctly as the site uses PNGs with alpha transparency. I then give them a link explaining why they should not use IE and the benefits of upgrading to another browser. My question is has anyone ever done this and what...
16
3747
by: Rahul Behal | last post by:
Hi What are the various C Language standards? Where are they available on the internet?
18
3428
by: Minti | last post by:
I was reading some text and I came across the following snippet switch('5') { int x = 123; case '5': printf("The value of x %d\n", x); break; }
115
4814
by: junky_fellow | last post by:
What is a C object ? If i have some function "func()" in my C program, then can i say that "func()" is a C object ? or if i have some function pointer (ptr) which contains the address of function "func()", can i say that ptr is pointing to some C object ? Is a C object always associated with some "data" ? thanx in advance for any help...
12
16283
by: Ant | last post by:
Hi, I need to return a value to a methods call from a switch statement nested in the method. How can this be done? int myMethod(int someValue) { switch (someValue) {
21
52286
by: markpapadakis | last post by:
I was checking out the C-FAQ and read here ( http://c-faq.com/misc/nonconstcase.html ) that: " case labels are limited to single, constant, integral expression ". However, I have been using case with ranges for a long while ( gcc, VC++) so either the FAQ calls for an update or those two compilers provide this functionality as an...
5
4501
by: Phuff | last post by:
Hey all, I need some direction help. I have a switch case statement that is seemingly my only option right now, but its too large and not easy to maintain the code. Here goes... I have part descriptions (ie. 3/8" X ____" NYLON ALL-THREAD RODS...or ____" x ____" X ____" ____ WRAPPED MULLION) that I need to replace the blank lines on. I do...
3
1768
by: editormt | last post by:
A recent poll asked if programming standards are used by development organisations... and if they are controlled. None: 20% Yes, but without control: 49% Yes, with control: 31% Participants: 369 Source: Methods & Tools (http://www.methodsandtools.com)
7
3351
by: Rohit | last post by:
Hi, I am working on a switch module which after reading voltage through a port pin and caterogizing it into three ranges(open,low or high), passes this range to a function switch_status() with parameters value and signal ID. Signal Id is used to get a user configurable parameter inside a configuration file, which depends on the type of...
0
7475
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7409
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7771
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3465
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.