tags:

views:

259

answers:

3

Where can I find sample *X*HTML 5 pages? I mainly want to know if it is possible to mix and match XHTML 5 with other XML languages just like XHTML 1 or not. For example is something like this valid in XHTML 5?

<!DOCTYPE html PUBLIC "WHAT SHOULD BE HERE?" 
          "WHAT SHOULD BE HERE?">
<html xmlns="WHAT SHOULD BE HERE?"
      xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
<head>
  <title><ui:insert name="title">Default title</ui:insert></title>
  <link rel="stylesheet" type="text/css" href="./css/main.css"/>
</head>

<body>

<div id="header">
    <ui:insert name="header">
        <ui:include src="header.xhtml"/>
    </ui:insert>
</div>


<div id="left">
  <ui:insert name="navigation" >
    <ui:include src="navigation.xhtml"/>
  </ui:insert>
</div>


<div id="center">
  <br />
  <span class="titleText"> <ui:insert name="title" /> </span>
  <hr />
  <ui:insert name="content">
    <div>
    <ui:include src="content.xhtml"/>  
    </div>
  </ui:insert>
</div>

<div id="right">
  <ui:insert name="news">
    <ui:include src="news.xhtml"/>
  </ui:insert>
</div>

<div id="footer">
  <ui:insert name="footer">
    <ui:include src="footer.xhtml"/>  
  </ui:insert>
</div>

</body>

</html>

Thanks in advance.

+1  A: 

Your best bet is probably the HTML5 specification's section on XHTML, which mostly calls out to the XML 1.0 5th edition spec and the namespaces spec. As it says there, there's no defined DOCTYPE for HTML5 in XML, which is the answer to the DOCTYPE part of your question. It does specifically mention intermixing HTML5 with other content in XML documents, so that should be the answer to that part of your question.

T.J. Crowder
+1  A: 

For example is something like this valid in XHTML 5?

No, and you couldn't do it with XHTML 1 either. Once you start doing FOO + BAR documents, they are not valid FOO or valid BAR, just some combination of the two (which may conform to a DTD and thus be valid FOO + BAR)

<!DOCTYPE html PUBLIC "WHAT SHOULD BE HERE?" 
      "WHAT SHOULD BE HERE?">

A custom DTD that describes the combination of markup languages you are using.

When mixing namespaces you are usually better off forgetting about DTDs. It isn't going to be HTML compatible anyway, so text/html is out of the question

<html xmlns="WHAT SHOULD BE HERE?"
       xmlns:ui="http://java.sun.com/jsf/facelets"&gt;

The XHTML namespace has not changed. This is the same as every other version of XHTML.

David Dorward
If the XHTML namespace has not changed, then how does a validator know if the document is XHTML 5 so hat elements like <dialog> are valid or if it is XHTML 1 so that <dialog> and other new elements are invalid?
Bytecode Ninja
Namespaces have never had anything to do with validation. You have to use either an explicit XHTML 5 validator or use a schema validator and pass it both a schema and your document.
David Dorward
So why do we even include a DOCTYPE and reference a DTD, if the XHTML document isn't validated against the DTD? Also, what you say implies that it is not possible to say whether a document is XHTML 1 or XHTML 5 solely by looking at its prologue, or is it?
Bytecode Ninja
Some XHTML documents (including the various flavours of 1.0 and 1.1, and I think there is a 1.0+SVG+MathML around somewhere) are validated against DTDs. XHTML 5 doesn't have a DTD.
David Dorward
So does this mean that it is impossible to know if an HTML document is XHTML 1 or XHTML 5 simply by looking at its prologue?
Bytecode Ninja
Yes. See http://stackoverflow.com/questions/2965449/xhtml-5-prologue-vs-xhtml-1-prologue/2965503#2965503
David Dorward
+2  A: 

You don't need a doctype at all. They are not designed to cope with namespaces and don't serve any useful purpose in XML. (In HTML, they are necessary to get into standards mode.) If you really insist on having one, for whatever reason, use simply <!DOCTYPE html>.

As for the namespace:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"&gt;

as you are already using, I assume.

As you see, there is no information about the version you're using. That's because you don't need it. For validation, you can pick your target in the UI, and browsers have never looked at versions. That is, in browsers, there is no such thing as HTML3.2 or HTML4.01 or HTML5, just "HTML", and no XHTML1.0, XHTML1.1 or XHTML5, only "XHTML". Today, those consist mainly of HTML4.01/XHTML1.0 and some parts of HTML5, as well as some proprietary parts (though HTML5 has specified most of these).

Ms2ger
So, if I am not wrong, it is not possible to distinguish an XHTML 1 document from and XHTML 5 document solely by looking at their prologues, is that right?
Bytecode Ninja