469,575 Members | 1,613 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Silly question about XHTML

I think I'm having a dim day and should just go back to bed, but alas, I cant
do that....

I'm writing a peice of code to create XHTML compliant documents using
System.IO, there's probably an easier way but anyway... my code works fine,
and it saves a file as an XML file. If I load this in IE, I get the xml
code!! (rather than the page it should generate). If I rename the file to
..xhtml, IE wont load it and I get the "choose program/service" dialog.

What am I doing wrong!?

Cheers, Dan.

Here's the generated xhtml..

<?xml version="1.0" encoding="UTF-8" ?>
<!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" lang="en">
<head>
<title>Test XHTML Page</title>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
</html>
---------------------------------------------
Jan 18 '06 #1
4 1078
I think you may be simply misunderstanding what IE would do with a file with
an extension of xml. It will load it and parse it as xml. If you try the
same document with an xml extension in firefox you will find it is displayed
as xhtml.

Try the document with an htm extension and it will load into IE perfectly.
If you want to keep it as a file with an xml extension then your going to
have to format it with an xsl stylesheet rather than expect the thml parser
to pick it up.

--
Regards

John Timney
Microsoft MVP

"musosdev" <mu*******@community.nospam> wrote in message
news:8E**********************************@microsof t.com...
I think I'm having a dim day and should just go back to bed, but alas, I
cant
do that....

I'm writing a peice of code to create XHTML compliant documents using
System.IO, there's probably an easier way but anyway... my code works
fine,
and it saves a file as an XML file. If I load this in IE, I get the xml
code!! (rather than the page it should generate). If I rename the file to
.xhtml, IE wont load it and I get the "choose program/service" dialog.

What am I doing wrong!?

Cheers, Dan.

Here's the generated xhtml..

<?xml version="1.0" encoding="UTF-8" ?>
<!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" lang="en">
<head>
<title>Test XHTML Page</title>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
</html>
---------------------------------------------

Jan 18 '06 #2
Cheers John, that makes a lot more sense - can you point me in the direction
of any tutorials on XSLT stylesheets?

Cheers
Dan

"John Timney ( MVP )" wrote:
I think you may be simply misunderstanding what IE would do with a file with
an extension of xml. It will load it and parse it as xml. If you try the
same document with an xml extension in firefox you will find it is displayed
as xhtml.

Try the document with an htm extension and it will load into IE perfectly.
If you want to keep it as a file with an xml extension then your going to
have to format it with an xsl stylesheet rather than expect the thml parser
to pick it up.

--
Regards

John Timney
Microsoft MVP

"musosdev" <mu*******@community.nospam> wrote in message
news:8E**********************************@microsof t.com...
I think I'm having a dim day and should just go back to bed, but alas, I
cant
do that....

I'm writing a peice of code to create XHTML compliant documents using
System.IO, there's probably an easier way but anyway... my code works
fine,
and it saves a file as an XML file. If I load this in IE, I get the xml
code!! (rather than the page it should generate). If I rename the file to
.xhtml, IE wont load it and I get the "choose program/service" dialog.

What am I doing wrong!?

Cheers, Dan.

Here's the generated xhtml..

<?xml version="1.0" encoding="UTF-8" ?>
<!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" lang="en">
<head>
<title>Test XHTML Page</title>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
</html>
---------------------------------------------


Jan 18 '06 #3
http://www.w3schools.com/xsl/xsl_transformation.asp

Got some good and very simple examples here

--
Regards

John Timney
Microsoft MVP

"musosdev" <mu*******@community.nospam> wrote in message
news:4E**********************************@microsof t.com...
Cheers John, that makes a lot more sense - can you point me in the
direction
of any tutorials on XSLT stylesheets?

Cheers
Dan

"John Timney ( MVP )" wrote:
I think you may be simply misunderstanding what IE would do with a file
with
an extension of xml. It will load it and parse it as xml. If you try
the
same document with an xml extension in firefox you will find it is
displayed
as xhtml.

Try the document with an htm extension and it will load into IE
perfectly.
If you want to keep it as a file with an xml extension then your going to
have to format it with an xsl stylesheet rather than expect the thml
parser
to pick it up.

--
Regards

John Timney
Microsoft MVP

"musosdev" <mu*******@community.nospam> wrote in message
news:8E**********************************@microsof t.com...
>I think I'm having a dim day and should just go back to bed, but alas, I
>cant
> do that....
>
> I'm writing a peice of code to create XHTML compliant documents using
> System.IO, there's probably an easier way but anyway... my code works
> fine,
> and it saves a file as an XML file. If I load this in IE, I get the xml
> code!! (rather than the page it should generate). If I rename the file
> to
> .xhtml, IE wont load it and I get the "choose program/service" dialog.
>
> What am I doing wrong!?
>
> Cheers, Dan.
>
> Here's the generated xhtml..
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!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" lang="en">
> <head>
> <title>Test XHTML Page</title>
> <link rel="stylesheet" type="text/css" href="test.css" />
> </head>
> </html>
> ---------------------------------------------


Jan 18 '06 #4
Also, there are some good XML standard references in MSDN library, here is
the web link:

#XML Standards Reference
http://msdn.microsoft.com/library/en...9d0-423a-a00f-
672e855de401.asp?frame=true

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "John Timney \( MVP \)" <ti*****@despammed.com>
| References: <8E**********************************@microsoft.co m>
<um**************@TK2MSFTNGP15.phx.gbl>
<4E**********************************@microsoft.co m>
| Subject: Re: Silly question about XHTML
| Date: Wed, 18 Jan 2006 17:01:03 -0000
| Lines: 79
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <eH*************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 81.168.102.157
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:371796
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| http://www.w3schools.com/xsl/xsl_transformation.asp
|
| Got some good and very simple examples here
|
| --
| Regards
|
| John Timney
| Microsoft MVP
|
| "musosdev" <mu*******@community.nospam> wrote in message
| news:4E**********************************@microsof t.com...
| > Cheers John, that makes a lot more sense - can you point me in the
| > direction
| > of any tutorials on XSLT stylesheets?
| >
| > Cheers
| >
| >
| > Dan
| >
| > "John Timney ( MVP )" wrote:
| >
| >> I think you may be simply misunderstanding what IE would do with a
file
| >> with
| >> an extension of xml. It will load it and parse it as xml. If you try
| >> the
| >> same document with an xml extension in firefox you will find it is
| >> displayed
| >> as xhtml.
| >>
| >> Try the document with an htm extension and it will load into IE
| >> perfectly.
| >> If you want to keep it as a file with an xml extension then your going
to
| >> have to format it with an xsl stylesheet rather than expect the thml
| >> parser
| >> to pick it up.
| >>
| >> --
| >> Regards
| >>
| >> John Timney
| >> Microsoft MVP
| >>
| >> "musosdev" <mu*******@community.nospam> wrote in message
| >> news:8E**********************************@microsof t.com...
| >> >I think I'm having a dim day and should just go back to bed, but
alas, I
| >> >cant
| >> > do that....
| >> >
| >> > I'm writing a peice of code to create XHTML compliant documents using
| >> > System.IO, there's probably an easier way but anyway... my code works
| >> > fine,
| >> > and it saves a file as an XML file. If I load this in IE, I get the
xml
| >> > code!! (rather than the page it should generate). If I rename the
file
| >> > to
| >> > .xhtml, IE wont load it and I get the "choose program/service"
dialog.
| >> >
| >> > What am I doing wrong!?
| >> >
| >> > Cheers, Dan.
| >> >
| >> > Here's the generated xhtml..
| >> >
| >> > <?xml version="1.0" encoding="UTF-8" ?>
| >> > <!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" lang="en">
| >> > <head>
| >> > <title>Test XHTML Page</title>
| >> > <link rel="stylesheet" type="text/css" href="test.css" />
| >> > </head>
| >> > </html>
| >> > ---------------------------------------------
| >>
| >>
| >>
|
|
|

Jan 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Peter Rohleder | last post: by
9 posts views Thread by Akseli Mäki | last post: by
27 posts views Thread by Gene Ellis | last post: by
17 posts views Thread by ccdrbrg | last post: by
32 posts views Thread by jp29 | last post: by
16 posts views Thread by Mcginkel | last post: by
82 posts views Thread by Buford Early | last post: by
11 posts views Thread by Michael Powe | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.