SitePoint Sponsor

User Tag List

Page 4 of 9 FirstFirst 12345678 ... LastLast
Results 76 to 100 of 215
  1. #76
    CSS Ninja
    Join Date
    Aug 2003
    Location
    mechanicsburg, pa
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    writing valid html and xhtml never seemed that difficult to me....

  2. #77
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It can be challenging at times, when you include external information over which you don't have complete control. In XHTML, you simply must ensure that included markup will not violate the well-formedness of your document, including escaping characters like '&'.
    Birnam wood is come to Dunsinane

  3. #78
    SitePoint Zealot LSW's Avatar
    Join Date
    Jul 2004
    Location
    Juneau Alaska
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wich is a very major problem!

    I have a site written as XHTML out of habit, and I had planed on serving it as application..... but it is a Gov. site, some 19 youth and childrensclubs have direct access to it and the root folder with no controls.

    They also have a input page for the calender where they regularly use and and & as well as other special characters. I have hastely put in a attempt to change these letters to the correct code, but am ot authorized to rewrite the code for the database.

    All in all, if I were to serve this as application and say XHTML 1.1, the site would fall apart due to all these people who I cannot possibley train to write correctly......... so was forced to drop back to serving it as HTML.

    So if untrained people have access to the input and output of the site, you better have a very strong solid CMS sytem to prevent someone toasting the site with bad code. I am looking at CMS for it now to protect it.
    Thank You, Migwetth, Gunalcheesh, Haw'aa, Danke

    Kyle Lamson



  4. #79
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well a lot of this is new to me. I use this on my websites:

    Code:
    <?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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    But from what I've read, I should switch to xhtml transitional?
    Mike
    It's not who I am underneath, but what I do that defines me.

  5. #80
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What gave you that impression?

    You should use the XHTML 1.0 Strict doctype if you are actually writing code that is valid for that doctype.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  6. #81
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is nothing in that code sample that suggest a need to go back to the stone age (Transitional doctype). If you use FONT elements, BORDER attributes, etc., then you should stick with Transitional.

    Using an XML declaration in an XHTML-P page served as text/html may not be a good idea, though, because (a) it ain't XML, (b) it will cause IE6 to render in quirks mode, and (c) it will confuse some really old browsers.
    Birnam wood is come to Dunsinane

  7. #82
    SitePoint Addict dannyh's Avatar
    Join Date
    Mar 2005
    Location
    BC, Canada
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE6 renders XHTML doctypees in quirks mode?

    IE6 renders the box model fine for me when I give a XHTML doctype... I think you have that mixed up AutisticCuckoo. I have never had to write IE "hacks" to get my border/padding/margin/width to look propper in both mozilla and IE.

  8. #83
    ☆★☆★ 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 dannyh
    IE6 renders XHTML doctypees in quirks mode?

    IE6 renders the box model fine for me when I give a XHTML doctype... I think you have that mixed up AutisticCuckoo. I have never had to write IE "hacks" to get my border/padding/margin/width to look propper in both mozilla and IE.
    No, IE renders pages with anything above a DOCTYPE (i.e. comments, the <?xml?> declaration) in quirks mode. It's a known bug in IE6. Try adding some linebreaks above the DOCTYPE of your XHTML documents (though this also happens with valid HTML 4.01) and watch the box model get screwy. It's very annoying when you're using a server-side language where you may not have control over the final whitespace output (ColdFusion and JSP I'm looking at you).

  9. #84
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    All my code complies with strict standards, yes. Someone posted earlier though that Strict wasn't supposed to be sent as text/html. But rereading it looks like no XHTML should be sent that way.

    So you guys think I should drop the XML declaration and keep it strict? What about my meta mimetype, do I even need that meta tag?
    Mike
    It's not who I am underneath, but what I do that defines me.

  10. #85
    ☆★☆★ 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 Mike
    Someone posted earlier though that Strict wasn't supposed to be sent as text/html. But ereading it looks like no DTD of XHTML should be sent that way.
    If your pages meet the guidelines set forth here, then you'll be fine sending your pages as text/html.
    Quote Originally Posted by Mike
    So you guys think I should drop the XML declaration and keep it strict? What about my meta mimetype, do I even need that meta tag?
    Yes drop the XML declaration. Keep it strict if it validates (in my opinion).

    As for the meta element declaring the content-type, it may still be useful for viewing pages offline, so the browser doesn't resort to its default encoding and mess up any special characters you may have in your pages.

  11. #86
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ok, thanks Vinnie
    Mike
    It's not who I am underneath, but what I do that defines me.

  12. #87
    SitePoint Addict dannyh's Avatar
    Join Date
    Mar 2005
    Location
    BC, Canada
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone have any links to writing a "real" XHTML document?

    I want to experiment with it just for fun, but Im not sure about the XML mime types and encoding etc. above the Doctype declaration. Also I see some peoples sites in the body tage they have a lang attribute... I know its just setting the language for the element, but Im not sure I have a huge understanding of this.

    It would be cool to have a link that talks about this stuff in one shot.

  13. #88
    ☆★☆★ 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 dannyh
    Does anyone have any links to writing a "real" XHTML document?
    It's a lot like writing an HTML 4.01 document, just add XML's syntax requirements as far as the markup goes.

    For CSS, be sure that your rules are case-sensitive, since under true XHTML case sensitivity applies.

    When it comes to Javascript, stick to DOM methods. Things like document.write() and innerHTML won't work. Be very careful if you're inserting ads in your pages, since most current ad insertion methods won't fly under real XHTML.

    For both CSS and scripts, don't even bother trying to use inline style/script. Hiding your code in CDATA sections is too much of a hassle with today's lousy browser support and if it's hidden in regular comments it will be ignored. Stick to external CSS and JS files.

    Now's the tricky part: server setup. If you have Apache it's pretty easy. Add this line into your .htaccess file:
    Code:
    AddType application/xhtml+xml;charset=utf-8 .xhtml
    Then use the .xhtml extension for your XHTML pages.

    Finally, in your markup the <?xml?> declaration is required if your character encoding is anything other than utf-8. Take note of this.

    Oh, and I'm sure I'm missing a thing or two, but someone else is sure to catch it

    Quote Originally Posted by dannyh
    I want to experiment with it just for fun, but Im not sure about the XML mime types and encoding etc. above the Doctype declaration. Also I see some peoples sites in the body tage they have a lang attribute... I know its just setting the language for the element, but Im not sure I have a huge understanding of this.
    The lang and xml:lang attributes aren't required, but they aid in both accessibility and search engine optimization. There's not too much other than that to say really, language stuff is pretty straightforward.
    Quote Originally Posted by dannyh
    It would be cool to have a link that talks about this stuff in one shot.
    Just link to this thread

  14. #89
    SitePoint Addict dannyh's Avatar
    Join Date
    Mar 2005
    Location
    BC, Canada
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can I mix XML within a XHTML document?

    example:

    <body>
    <name>Danny</name>
    <message>Hello, world!</message>
    </body>

    Or am I still limited to the HTML tags...

    and if I can use my own tags, can I style them using CSS or do I need to call up a XML stylesheet (another area I am still foggy on)?

  15. #90
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use XML elements if you use a custom doctype.

    You can use XSLT and/or CSS to define how elements are rendered.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  16. #91
    ☆★☆★ 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 dannyh
    Can I mix XML within a XHTML document?

    example:

    <body>
    <name>Danny</name>
    <message>Hello, world!</message>
    </body>

    Or am I still limited to the HTML tags...
    You can mix XML in an XHTML document. Just namespace it properly. Now, how browsers render those elements by default and what kind of semantics they will or won't apply to these elements is another topic completely .
    Quote Originally Posted by dannyh
    and if I can use my own tags, can I style them using CSS or do I need to call up a XML stylesheet (another area I am still foggy on)?
    You can style XML with CSS. It works decently in most browsers. You have to be very explicit about how you style it though, because unlike HTML's h1 or paragraph, your custom tags don't come with any "default" mode of display. You can also use XSL to transform your markup into HTML/XHTML, but if you just want a certain look CSS will work just fine.

  17. #92
    SitePoint Addict dannyh's Avatar
    Join Date
    Mar 2005
    Location
    BC, Canada
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    You can also use XSL to transform your markup into HTML/XHTML, but if you just want a certain look CSS will work just fine.
    what do you mean by that? could you explain further please if you have time

  18. #93
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Google's first few results look useful.
    http://www.google.com/search?q=XSL
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  19. #94
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XSL (XSLT, to be specific: eXtensible Stylesheet Language Transformations) can be used to transform any XML document into something else. Usually HTML or XHTML.

    XSLT is itself an application of XML, i.e. it uses XML syntax to mark up the transformations. It incorporates features like conditions (e.g. <xsl:choose>) and iterations (e.g. <xsl:for-each>).

    Adding your own element types may seem like a cool idea, but think about it: they won't mean anything to the browser, to search engines, or to assistive technologies like screen readers. They are fine as a data storage format, where your own application defines the semantics, but not on the web.
    Birnam wood is come to Dunsinane

  20. #95
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz
    From the point of view that, XHTML is XML-ized HTML, I meant what I said.

    XHTML is just a standardized list of XML elements and attributes that happens to look a lot like HTML, right?
    Yes, that is true of XHTML 1.0 in particular.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  21. #96
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dannyh
    Can I mix XML within a XHTML document?

    example:

    <body>
    <name>Danny</name>
    <message>Hello, world!</message>
    </body>

    Or am I still limited to the HTML tags...

    and if I can use my own tags, can I style them using CSS or do I need to call up a XML stylesheet (another area I am still foggy on)?
    Yes and no. The short answer is no, because if you mix in elements from other languages, then it ceases to become XHTML (and it becomes "elements from XHTML mixed with something else").

    The long answer, however, is yes, you can combine XHTML with other languages in an XML document. This is done with namespaces. You can make up your own namespaces, or use other people's. The limitation to this is that the user agent that reads your document needs to recognise the namespaces you use.

    To declare that an element is in the XHTML namespace:

    <html xmlns="http://www.w3.org/1999/xhtml">

    To declare that an element is in the MathML namespace:

    <math xmlns="http://www.w3.org/1998/Math/MathML">

    To declare that an element is in your own namespace:

    <myelement xmlns="http://mysite.com/mynamespace">

    However, the above won't mean anything to an application unless it is programmed to understand it. The namespace attributes I show above look like URIs, but they are really just a unique name given to the namespace.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  22. #97
    SitePoint Guru puco's Avatar
    Join Date
    Feb 2005
    Location
    Slovakia
    Posts
    785
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by LSW
    Wich is a very major problem!

    I have a site written as XHTML out of habit, and I had planed on serving it as application..... but it is a Gov. site, some 19 youth and childrensclubs have direct access to it and the root folder with no controls.

    They also have a input page for the calender where they regularly use and and & as well as other special characters. I have hastely put in a attempt to change these letters to the correct code, but am ot authorized to rewrite the code for the database.

    All in all, if I were to serve this as application and say XHTML 1.1, the site would fall apart due to all these people who I cannot possibley train to write correctly......... so was forced to drop back to serving it as HTML.

    So if untrained people have access to the input and output of the site, you better have a very strong solid CMS sytem to prevent someone toasting the site with bad code. I am looking at CMS for it now to protect it.
    AFAIK and other "special" characters are completely valid in XHTML and shouldn't break validity/usability of the page. You just need to set correct encoding and serve the page with that encding (e.g. UTF-8). IMO it is better then converting the characters to (X)HTML entities, which is waste of space.
    Martin Pernecky

  23. #98
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by puco
    AFAIK and other "special" characters are completely valid in XHTML and shouldn't break validity/usability of the page. You just need to set correct encoding and serve the page with that encding (e.g. UTF-8). IMO it is better then converting the characters to (X)HTML entities, which is waste of space.
    That is true, but it becomes a problem when the author uses, for instance, ISO 8859-1 in her editor and the character encoding for the page is declared as UTF-8. The encoding for '' in ISO 8859-1 is not the same as the encoding for '' in UTF-8. Furthermore, the encoding for '' in ISO 8859-1 is not a valid encoding for anything in UTF-8, which causes a well-formedness error.

    The best thing, if possible, is to use UTF-8 throughout the publishing process. But not all tools support UTF-8 as output, and then you have to be careful or run a conversion tool before the page is published.
    Birnam wood is come to Dunsinane

  24. #99
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    That is true, but it becomes a problem when the author uses, for instance, ISO 8859-1 in her editor and the character encoding for the page is declared as UTF-8. The encoding for '' in ISO 8859-1 is not the same as the encoding for '' in UTF-8. Furthermore, the encoding for '' in ISO 8859-1 is not a valid encoding for anything in UTF-8, which causes a well-formedness error.
    HTML/XHTML defines the 'accept-charset' attribute for web forms, which tells the browser which character encoding to use when sending form data. However, this cannot be relied upon from the server side because a user agent may break the rules or somebody may submit POST data to your server without using your form.

    Ideally, the server side application you use would be aware of character encodings and would automatically convert all input to the desired character encoding, or at least filter out all characters which are invalid in the current character encoding. However this isn't often the case. For example, PHP has no concept of character encodings (without the mbstring extension, which is not included by default) and will accept 'character soup' as input.

    The reality is that if your server side application accepts input from a browser, it cannot make any assumptions about which character encoding is being used, so it must do something to convert or filter out invalid characters in input. This is non-trivial if your application uses UTF-8.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  25. #100
    SitePoint Zealot LSW's Avatar
    Join Date
    Jul 2004
    Location
    Juneau Alaska
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK - then I need clarification:

    The URL is http://www.neukoelln-jugend.de/vkalend/index.php

    This is a Calender of events. I was not allowed to recode it other than make it fit my design. Currently it is served as XHTML 1.0 Transitional but as text/html. It was Strict but i changed it do to validation problems.

    Those adding items here have no idea of HTML and were never required to do anything special, was written and was output.

    Now if I force this to be served as UTF-8 with say some content negotiation and change the Meta to application/xhtml+xml and UTF-8 for those who may download the page, would I be able to then allow plain text or would it still need to be re-coded to UTF-8 code?

    Now they have decided they want this in a CMS, so I am struggling to find out how plausible it is and if it is my chance to ditch this old script. So it may not be a question anymore. But still, if it is served as UTF-8 I don not need to code special language characters anymore?
    Thank You, Migwetth, Gunalcheesh, Haw'aa, Danke

    Kyle Lamson




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
  •