SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member SiNiStEr NaTiOn's Avatar
    Join Date
    Nov 2003
    Location
    united states
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question if this can be done with XHTML & XML

    I've been looking for tutorial that deals with XHTML & XML working together, and not having much luck. I'm trying my best to understand XHTML & XML. I like to set up my navigation menu in XML and for it to show up in my XHTML. I just don't know how to achieve this and setting up the url links to the pages. I'm pretty sure I have my XHTML document setup properly

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    <Meta tags here />
    <base ref here />
    <link href="location to the pages in my site" />
    <link rel="stylesheet" href="loaction of my style sheet" />
    <link rel="shortcut icon" href="location for favicon" />
    </head>
    
    <body>
    
    </body>
    </html>
    If this is in the wrong forum I'm sorry, just wasn't for sure where to post this at.

  2. #2
    SitePoint Evangelist ClevaTreva's Avatar
    Join Date
    Jan 2004
    Location
    Chipping Campden, UK
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    There isn't much point in making a site xml, as there isn't the browser support for it.

    BUT, by making it xhtml, you meet the xml standards too, just that you don't use the advanced features of xml that will confuse browsers that aren't with it.

    So, really, design for xhtml now, use exclusively (or at least as much as you can) css for styling and layout, and tables ONLY to handle tabular data (ie not design).

    I can't see the point of going for xhtml 1.0 strict. You might as well do 1.1 strict. It cuts out a few things, but xml won't allow them anyway.

    Your code looks OK, except DON'T use the <?xml declaration at the start, as it knocks IE for six, and doesn't do anything important (yet).

    For one of your meta tags, you need to declare the language and character set, my standard code starts like this:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    Note that xhtml1.1 does not allow the use of lang="en" in the head, you must use the xml:lang="en", whereas xhtml1.0 did allow it.

    Just make everything lower case, end unpaired tags (img, etc), fully declare attributes (e.g. <input ...... enabled> is no good, it needs <input ..... enabled="1"), no use of target on links (if necesary, use java to open a new window and name the window if you want). All content has to be inside block tags (<div>, <p>, etc.) and use id and class declarations everywhere you want to change the default behavior of a tag.

    Also, other good bits of advice for css:

    Set all major tags to margin:0, border:0 and padding:0 to level the browser playing field (html, body, hr, ul, li, img, div, p, etc.) as the browsers all have different defaults, and even some versions are different from others.

    Set the font size to 76% in the body (font-size:76%) and then use ems for font-size, padding and margins therein. DO set a default font family for the page (something like font-family:verdana,arial,sans-serif.

    Do not set much on default tag types (div, p, img, a, ul, li, etc), rather, give them an id (if they are used once in the page) or a class (for multiple use in the page) and set things like font attributes, text-alignments, color etc.

    Design for Firefox or Safari and then modify it to work in IE (remember that IE 5 has a major box model bug) for PC and MAC (MAC version is woefully lacking and different to IE5.x for the PC).

    Do watch out for major IE bugs (see www.positioniseverything.net ) such as the justified italics bug, the 3 pixel jog, and so on.





    Trevor

  3. #3
    SitePoint Member SiNiStEr NaTiOn's Avatar
    Join Date
    Nov 2003
    Location
    united states
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanxs for the wonderful tips ClevaTreva, because I do want to get use to building a XHTML site.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by ClevaTreva
    Do watch out for major IE bugs (see www.positioniseverything.net )
    such as the justified italics bug, the 3 pixel jog, and so on.
    yes, indeedy, watch out for them

    but my advice is not to try to hack your way around them

    you'll drive yourself nuckin futs

    see the IE6 Peekaboo Bug

    then read on to the The IE Three Pixel Text-Jog

    make sure you read everything, all the way down to the Holly hack

    css involves a certain amount of zen

    if you find yourself hacking your way around all these bugs,
    then you have not yet grasped the pebble, grasshopper
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    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)
    The XML declaration does plenty if you serve XHTML as XHTML instead of text/html. As you are aware such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16.

    As was previously stated though unless you are serving to an xml processor generally you are just as well writing xhtml for a static page.

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by r937
    if you find yourself hacking your way around all these bugs,
    then you have not yet grasped the pebble, grasshopper

    Quote Originally Posted by ClevaTreva
    I can't see the point of going for xhtml 1.0 strict. You might as well do 1.1 strict. It cuts out a few things, but xml won't allow them anyway.
    The reason for XHTML 1.0 Strict vs. XHTML 1.1 is probably that whole "XHTML shouldn't be served as text/html, only application/xhtml+xml" thing, because IE doesn't really support it. Of course, that's only if you care about that sort of thing.

  7. #7
    SitePoint Evangelist ClevaTreva's Avatar
    Join Date
    Jan 2004
    Location
    Chipping Campden, UK
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia


    The reason for XHTML 1.0 Strict vs. XHTML 1.1 is probably that whole "XHTML shouldn't be served as text/html, only application/xhtml+xml" thing, because IE doesn't really support it. Of course, that's only if you care about that sort of thing.
    Hi

    Yes, I agree about the shouldn't be, but it can be!

    IE and the other browsers are happy with it being served as text/html, and so you can get away with that for now, whilst cutting out code in xhtml1.0 that isn't allowed in 1.1

    It juts makes changing over in the future a bit easier. But then, I guess changing the doctype is no hassle either, if you have coded for 1.1 anyway.




    Trevor

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ClevaTreva
    IE and the other browsers are happy with it being served as text/html, and so you can get away with that for now, whilst cutting out code in xhtml1.0 that isn't allowed in 1.1
    I don't know...other than the extensibility aspect of XHTML 1.1 (which is semi-useful if you have the need for it), I don't see the benefit of it over XHTML 1.0. Since XHTML 2.0 isn't compatible with 1.0 or 1.1 anyway it's still going to be some work to migrate later. XSLT will change either 1.0 or 1.1 to XHTML 2.0 so I'm not worried about using 1.1.


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
  •