SitePoint Sponsor

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 25 of 60
  1. #1
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    If I code in strict XHTML will it validate in transitional doctype?

    Hello,

    Weird question but I couldn't find the answer so apologies if it has been answered and I know it might seem like a noob question.

    I need to create a website, and I want to develop it with a strict xhtml doctype. However when I am done creating the website, I have to hand it over to another department that wants it as a transitional xhtml doctype.

    So I was going to develop everything with a strict xhtml doctype, and then just change the doctype to transitional before handing it off.

    My question is, if I go this route will I experience any validation issues?

    Thanks in advance

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Probably not since with Strict you have less Elements/Attributes to choose from (to start with).

    But if you were going Transitional to Strict then you possibly would have issues, e.g. the evil FONT not being available in Strict, etc. You get the gist...

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    There will not be any validation issues since the only difference between strict and transitional as far as HTML is concerned is that transitional allows HTML 3.2 tags where strict does not.

    It may have an impact on JavaScript attached to the page though as some browsers look for values in different places depending on whether a strict or transitional doctype is used - although the main browser where this is an issue is Internet Explorer and the only version of that browser to support XHTML is IE9 which is still in development.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome thanks for the reply guys . The whole IE issue still confuses me, every client/firm wants me to code in xhtml but I keep hearing it is not fully supported in IE yet I see alot of websites use it. I guess I need to further research to really know what the negatives are when using an xhtml doctype and my IE visitors.

  5. #5
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,881
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    Awesome thanks for the reply guys . The whole IE issue still confuses me, every client/firm wants me to code in xhtml but I keep hearing it is not fully supported in IE yet I see alot of websites use it. I guess I need to further research to really know what the negatives are when using an xhtml doctype and my IE visitors.
    People who want to write in XHTML generally are the ones who fall for any new buzzword around the office...

    Unless you know that no-one using your website will be using IE<=8 (eg it's an intranet and you only deploy Firefox on your network), you have to serve the document as text/html rather than application/xhtml+xml. And once you've served it as text/html, it is HTML, not XHTML, even if you're using an XHTML doctype and syntax.

    But yes, in answer to your original question - if it validates as Strict then it will also validate as Transitional - because Transitional is just like Strict but not as, well, strict. It allows everything the same, and a bit more.

  6. #6
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm it seems as though xhtml is widely being used mostly for the strict way it wants you to code..(ie: closing all tags, all lowercase, etc) unless of course you are actually trying to utilize xml.

    Would this be why the sitepoint website is xhtml? I wonder if sitepoint has written anywhere why it uses xhtml instead of html as I would be very interested in reading such an article. Especially if they explain why and give in depth reasoning as to what made them go that route.

    For those that theme scripts like joomla and wordpress, what doc type do you usually use?

    And for those who want to learn more like me, this is an interesting article:
    - http://reference.sitepoint.com/html/html-vs-xhtml

  7. #7
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    Hmm it seems as though xhtml is widely being used mostly for the strict way it wants you to code..(ie: closing all tags, all lowercase, etc) unless of course you are actually trying to utilize xml.
    Actually xhtml is hardly being used at all on the web.

    Would this be why the sitepoint website is xhtml?
    But it isn't. An xhtml doctype and xhtml style tags doesn't make it into xhtml. You have to serve it as xhtml too, and nobody does that because IE won't show it if they do.
    Ed Seedhouse

  8. #8
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    Hmm it seems as though xhtml is widely being used mostly for the strict way it wants you to code..(ie: closing all tags, all lowercase, etc) unless of course you are actually trying to utilize xml.
    I think you've hit the nail right on its head

    I code in xhtml, although I serve the documents as html because of IE etc, because I want my html coding (at least for commercial websites) to be consistent throughout as passing the w3c validator certifies.

    others could argue that html strict is better, which I am not convinced it is, but it boils down to personal choice.

  9. #9
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ed Seedhouse View Post
    But it isn't. An xhtml doctype and xhtml style tags doesn't make it into xhtml. You have to serve it as xhtml too, and nobody does that because IE won't show it if they do.
    Well that's my confusion, if you aren't serving it as xhtml then why even use the doctype and why code it as xhtml...Which is why I mentioned that it would be great for the sitepoint gurus to create an article as I am sure this would help alot of people like me from having to go into a padded room...

    Quote Originally Posted by Ed Seedhouse View Post
    Actually xhtml is hardly being used at all on the web.
    I guess I meant the doctype mainly. Most major/popular websites I know of use this, it is very rare that a website i frequently use doesn't use xhtml:

    - wordpress.org
    - facebook.com
    - myspace.com
    - sitepoint.com
    - w3c.org
    - cisco.com
    - bankofamerica.com
    - etc.....


    Quote Originally Posted by Kalon View Post
    I think you've hit the nail right on its head
    lol, nice thank you for the validation that there is still some sanity left in my understanding

  10. #10
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    Well that's my confusion, if you aren't serving it as xhtml then why even use the doctype and why code it as xhtml...
    That is the main thrust of the argument pushed by the pro html strict coders.

    Personally I don't see any significant, if any, "technical" advantage of using 1 over the other.

    It boils down to personal choice based on which you prefer and what you are used to.

  11. #11
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am still catching up to HTML5, is the coding loose like HTML4 where you can have lower case and unclosed tags or is it strict like XHTML where everything has to be closed, lowercase, etc..

    I guess I am asking, if I code in XHTML xtrict or transitional would it be a pain to convert my website to HTM5?

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    I am still catching up to HTML5, is the coding loose like HTML4 where you can have lower case and unclosed tags or is it strict like XHTML where everything has to be closed, lowercase, etc..

    I guess I am asking, if I code in XHTML xtrict or transitional would it be a pain to convert my website to HTM5?
    (X)HTML5 allows either HTML or XHTML syntax to be used depending on which you prefer.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    (X)HTML5 allows either HTML or XHTML syntax to be used depending on which you prefer.
    That is great news!! Thank you!

  14. #14
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    I guess I am asking, if I code in XHTML xtrict or transitional would it be a pain to convert my website to HTM5?
    To be honest, I haven't looked closely at the new elements in HTML5 because it is not fully supported yet in all the major browsers.

    Eventually when HTML5 becomes fully supported I would be very surprised, and even more disappointed, if websites coded in HTML or XHTML Strict had to be converted to HTML5 for them to continue working properly. I doubt very much we will have to do that.

    The only time you might have to update/convert a (X)HTML4 Strict web page to HTML5 is if you need to add some HTML5 specific feature that you cannot replicate using (X)HTML4.

    When HTML5 becomes fully supported then I will look at coding in HTML5

    Hopefully I won't be proven wrong on the above

  15. #15
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, I was under the impression that people already started to code via HTML5 .. at least that is what I keep hearing. I guess it would be safe to code in HTML5 but use XHTML syntax then when HTML5 is fully supported you can begin implementing the HTML5 specific features. ...

    However I don't even want to know how this is going to affect users pre-IE9 ... considering that clients still ask for websites to be compatible for IE7 at minimum.

  16. #16
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4SeeN View Post
    hmm, I was under the impression that people already started to code via HTML5 ...
    I just did a google to find which browsers support HTML5 and to what extent.

    I found this interesting browser testing website

    http://html5test.com/

    Pointing 3 of my browsers to that url gave the following scores measuring how well they support HTML5

    IE8 - 27/300 (27 out of a max of 300)

    FF3.6 - 139/300

    Opera10 - 67/300

    Now I have no idea how reliable the site's testing process is but regardless of the actual scores I think it's fairly safe to assume the above 3 browsers do not fully support HTML5 yet.

    I believe, from the blurbs I read elsewhere, that IE9 will be much more HTML5 compatible but I don't know to what extent.

  17. #17
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice thanks for the link. I guess it is probably safe to just continue using XHTML transitional served as HTML lol. Boy oh Boy, I am not really sure if I will be ready when HTML5 becomes a standard and clients want to code for that yet still have websites render correctly on IE7

  18. #18
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't worry about it too much atm.

    In that case I would explain to the client that not all their required to be supported browsers support HTML5 features and so give them the opportunity to water down their site specifications if they wish.

    If they insist on HTML5 features and to also support non HTML5 browsers then you can just charge them accordingly for the extra work to provide alternative code for non HTML5 browsers.

    Yes it will probably mean a little more work for developers, but I prefer to think of it as an opportunity to make a few extra dollars.

  19. #19
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Since HTML5 is still only a draft there is still plenty of time for it to change before it becomes a standard. Also judging by the huge percentage of web sites that are yet to finish upgrading to use HTML4 13 years after it became a standard it will probably be several decades before HTML5 starts to become important. After all the browsers can't fully support it before it becomes a standard and if they do rush in too quick beforehand then we'll just end up with a repeat of what happened when IE5 tried to support CSS2 before it became a standard which led to the introduction of quirks mode to allow pages that used that abandoned version of the standard to be rendered correctly.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  20. #20
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,272
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    hmm, I was under the impression that people already started to code via HTML5 .. at least that is what I keep hearing. I guess it would be safe to code in HTML5 but use XHTML syntax then when HTML5 is fully supported you can begin implementing the HTML5 specific features. ...
    Here's a site that, when I sniffed through the code, was as much HTML5 as they could stand: betribes.com I mean, if you look at youtube.com it's mostly the doctype and they wanted to use <video> (which lets me actually use youtube on my machine as I don't have Flash but I do have Chrome).

    Why SitePoint uses XHTML? Because the X is seXy. There is no other reason. The X is seXy. Similarly, many of the sites using HTML5 think the "5" is sexy. Meh.

    I prefer HTML4 Strict BUT I will send it through the validator and tell the validator to pretend it's XHTML1 Strict. So I write as strict as I would if I were writing XHTML, but don't use that doctype and don't use closing slashes (if they're ignored by the browser, then why do I have them?). Yeah, same could be said for selected="selected" when the browser only bothers looking at the first "selected", but again I guess it's the strictness that's appealing and /> would invalidate my HTML4 : )

  21. #21
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wanted to thank everyone who posted in this thread, I learned alot!

    Cheers!

  22. #22
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's perfectly fine to use XHTML syntax in the new HTML(5) doctype - I do it all the time because I prefer the stricter syntax. If you want to "convert" your website to "HTML5" all you need do is change the doctype at the top. All browsers (including IE6) will still display your page in the same way, so it is completely safe to do this. It's also completely safe to use the new features of the spec, with sufficient fallback (which will not take you long to do)

    When the W3C spec becomes recommendation, it will still be ok to use the HTML4 and XHTML doctypes - support for these will not go away. You'll just probably have to change your doctype when you want to use new features. And then work on HTML will continue: it will still use the same new HTML doctype

    sitepoint.com (not the forums) uses the new HTML doctype with XHTML syntax

  23. #23
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Code in Strict, deploy in Tranny is common practice for when you can't trust the next joker to come along to have any business writing markup in the first place (Which it sounds like your marketing department falls into the category of). There are ZERO problems since technically STRICT is a SUBSET of Transitional -- Tranny just has all the extra crap you have no business using in coding a website after 2002 still in it. (basically when we were able to kick Nyetscape 4 to the curb)

    Quote Originally Posted by clairs View Post
    It's perfectly fine to use XHTML syntax in the new HTML(5) doctype - I do it all the time because I prefer the stricter syntax.
    Just kiss off having validation that means a damn since the HTML5 spec is so loose it makes Belladonna look like the Mother Mary. [i](Just another of the reasons I have ZERO use for that steaming pile of manure known as HTML5 -- the day it becomes 'expected' for new sites is probably the day I stop developing altogether)

    Though as already implied by many posters, not that ANYONE has any business using HTML5 for production sites for the forseeable future.

    Quote Originally Posted by clairs View Post
    When the W3C spec becomes recommendation, it will still be ok to use the HTML4 and XHTML doctypes - support for these will not go away.
    Which is something a lot of people seem to lose sight of -- lands sake HTML 3.2 still works just fine if you feel like a trip in the wayback machine to 1997.

    Quote Originally Posted by Stevie D View Post
    Unless you know that no-one using your website will be using IE<=8 (eg it's an intranet and you only deploy Firefox on your network), you have to serve the document as text/html rather than application/xhtml+xml. And once you've served it as text/html, it is HTML, not XHTML, even if you're using an XHTML doctype and syntax.
    Christmas on a cracker not this bull again. It says in the XHTML specification it's ok to change the mime-type to text/html -- so how is it NOT XHTML? WAY too much value is put on mime-type by some folks, when frankly I don't even think it should be relevant and was a bad idea from the start!

    IF you want to use it as a XML application, then sure, serving it with the allegedly "wrong" doctype presents that -- but if you want a XML application you should be using 1.1, not 1.0

    1.0 exists to bridge the gap between XML and HTML being subsets of BOTH -- this is WHY either mime-type is valid. It gives you the clean consistent rules of XML, the ability to parse it with a standard XML parser and backwards compatibility to HTML. If you are trying to use it for anything more than that, you missed the point of XHTML 1.0

    "Oh but it's not true XHTML" -- BULLCOOKIES.

  24. #24
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    WAY too much value is put on mime-type by some folks
    The MIME type is what tells the browser how it is supposed to handle the content.

    If you tell the browser that it is HTML then it processes it as HTML regardless of the doctype (which the browser ignores except for checking that there is one).

    So if you have an XHTML doctype and an HTML MIME type then the source is written in XHTML but the browser interprets it as HTML.

    If you want the browser to interpret it as XHTML instead of HTML then you have to give it an XHTML MIME type.

    That XHTML 1.0 can be served as HTML, XHTML, or XML is what allows its use to transition from one to the other as all you have to do to convert your site from HTML to XHTML (at least as far as the (X)HTML is concerned) is to change which MIME type you use. You can't do that with any other version of (X)HTML.

    That it can be served as HTML does not make that HTML into XHTML though. When you serve XHTML as HTML you can only use the sub-set of XHTML that is able to be interpreted as HTML. For example:

    <script type="application/javascript" src="myscript.js"/>

    perfectly valid XHTML 1.0 if served as XHTML but cannot be served as HTML and so cannot use the HTML MIME type.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  25. #25
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,881
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    Christmas on a cracker not this bull again. It says in the XHTML specification it's ok to change the mime-type to text/html -- so how is it NOT XHTML? WAY too much value is put on mime-type by some folks, when frankly I don't even think it should be relevant and was a bad idea from the start!

    IF you want to use it as a XML application, then sure, serving it with the allegedly "wrong" doctype presents that -- but if you want a XML application you should be using 1.1, not 1.0

    1.0 exists to bridge the gap between XML and HTML being subsets of BOTH -- this is WHY either mime-type is valid. It gives you the clean consistent rules of XML, the ability to parse it with a standard XML parser and backwards compatibility to HTML. If you are trying to use it for anything more than that, you missed the point of XHTML 1.0

    "Oh but it's not true XHTML" -- BULLCOOKIES.
    One of the requirements of XHTML is zero error compensation. Any syntactical error must result in a YSOD, user agents must not try to recover from it.

    As far as I am aware, there are no browsers that do this when it is served as text/html, therefore there are no browsers that treat pages served as text/html as XHTML. You are getting none of the advantages of XHTML, but most of the headaches, and you're setting yourself up for some really big headaches in the future. The only reason that you are allowed the kludge of serving XHTML as text/html with the *******ised self-closing tags (that are technically wrong in both languages) is because W3 realised that MS were so stuck in the stone age that with IE not supporting proper XHTML, if they didn't introduce any such kludge, XHTML would have been stillborn - if there was no way to make it work with IE, nobody would have given it the second glance that it didn't deserve.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •