Questions tagged [xhtml]

XHTML is the traditional name for what is now formally called the XML syntax of HTML, as opposed to the more commonly used HTML syntax, both of which are defined by the HTML5 standard. It is a markup language commonly used for HTML pages which are generated using a XML based tool chain. Do NOT use this tag for Facelets. Use [facelets] instead.

XHTML (eXtensible HyperText Markup Language) is an application of XML and a syntax of HTML. This syntax is available as an alternative to the more common HTML syntax, which was formerly based on SGML. It is a markup language commonly used for HTML pages which are used within an XML based tool as part of server-side specific (MVC) framework, such as Facelets and ASP.NET Web Forms.

Initially, XHTML 1.0 and XHTML 1.1 were defined in separate specifications from HTML 4.01, but now the HTML5 specification covers both syntaxes together.

The XML syntax has an orthogonal rule set which takes no account of the element types being used, whereas the HTML syntax has different rules for different types of elements. For example, void elements in HTML such as <link>, <meta>, <br> and <hr> are marked up using only start tags in the HTML syntax, while <div>, <span>, <a> etc. must always have separate start and end tags. Other tags, for example <p>, <li> <td> etc. have special rules about when start and end tags need to be used. In contrast, in the XHTML syntax all elements must be closed, either using separate start and end tags: e.g. <div> and </div> or, if they have no content, by using a shortened form e.g. <div /> The two syntaxes are mutually incompatible, and XML tools do not work directly on documents written in the HTML syntax.

XHTML was introduced to allow developers to exploit the simplification that this orthogonality brings.

XHTML is often used as the basis for server-side markup languages, so that the can be manipulated by XML-based tools. The final output of these tool chain might be generated documents in the regular HTML syntax or in the XHTML syntax prior to sending to the browser.

One common confusion with XHTML is over the use of doctypes and content types. Using one of the XHTML 1 doctypes (now all obsolete) caused HTML validators to check whether document were consistent with the XHTML syntax, while browsers treated the same documents as being in the regular HTML syntax. Browsers do not use the doctype to determine which syntax the document is in. Instead they use an HTTP header: content-type. An XHTML syntax document must be supplied to the browser with an XML content type, usually application/xhtml+xml or application/xml. Regular HTML syntax documents should be supplied with a content type of text/html. Modern validators now, like browsers, use the content type HTTP header to determine which syntax to check against, and for both syntaxes the doctype in the form <!DOCTYPE html> should be used.

The XML syntax of HTML requires the following which are optional in the regular HTML syntax:

  1. Root XML namespace attribute as in <html xmlns="http://www.w3.org/1999/xhtml">
  2. Elements must be nested. e.g. <b><i></b></i> is an error that will cause parsing to stop
  3. Start and end Tags must always be matched, or elements self-closed. (e.g. use <input></input> or <input /> but not <input>)
  4. Tag and attribute names must be all in lowercase (e.g. use 'onclick, notonClick`)
  5. Attribute values must be quoted with matching single or double quotes (e.g use class='foo', or class="foo", not class=foo)
  6. Attribute minimization is forbidden (e.g. use disabled="disabled" or disabled="", not disabled)

Resources:

6730 questions
2
votes
2 answers

Wrapping all elements with href attribute using XSLT

I want to wrap any tag that contains a href attribute into an tag. eg. would become:
Chris_F
  • 4,991
  • 5
  • 33
  • 63
2
votes
1 answer

Using foreach into jsf / xhtml

Well, I array a dataTable where i must have some dynamic columns.... So im using dataTable... Like the code above:
Igor
  • 1,397
  • 3
  • 24
  • 56
2
votes
0 answers

xmlns in intellij project are not recognized?

Currently I am working on a presentation layer for a software project in java. In the skeleton project we were provided with, there already were a bunch of namespaces included.
bee
  • 21
  • 3
2
votes
1 answer

jQuery XHTML Compliance

I am a little confused. I switched my content-type over to application/xhtml+xml on my server because I am using XHTML + some extra attributes (set with ). Since I did this, all hell broke loose. For example, I have an autocomplete box…
Aviv
  • 75
  • 7
2
votes
0 answers

How to start creating a language extension for VS Code?

Pursuant to the discussion in Add XHTML support, I'd like to start creating an extension for Visual Studio Code which would implement support for XHTML. Which is HTML with XML syntax, so the the desired functionality is already (mostly?) implemented…
2
votes
1 answer

Validate HTML code created by jQuery

I have an HTML page, by clicking elements like buttons new DOM elements are appended to my document using jQuery (i.e. $('#foo').append('
...
');). I also remove DOM elements using remove(). I'm aware of validator in order to validate my…
Anna Fr.
  • 75
  • 6
2
votes
1 answer

XSL -> XHTML with doctype set in the template, won't transform

I'm trying to produce a valid XHTML document from XML data. I'm doing so using MSXML object library, not .NET. With .NET there are no problems, transforms just fine. My XSL template has this:
GSerg
  • 76,472
  • 17
  • 159
  • 346
2
votes
4 answers

load div then delay load next in jquery

Hi I have a gallery which has left floated divs in, the pictures are the backgrounds for each div, what i want is for each picture to load with a slight delay so first will load then wait say 5 seconds then the 2nd etc in a sequence, i have seen it…
graham
  • 53
  • 1
  • 4
2
votes
4 answers

Legacy html form in ASP .net application

I have an html page that I am converting over to an asp .net page. This page contained a form that accesses an external website that I have no control over. There is some sample code below:
Brian
  • 2,191
  • 3
  • 20
  • 30
2
votes
1 answer

XHTML namespace issues with cssselect in lxml

I have problems using cssselect with a XHTML (or XML with namespace). Although the documentation says how to use namespace in csselect I do not understand it: cssselect namespaces My Input XHTML string:
therealmarv
  • 3,692
  • 4
  • 24
  • 42
2
votes
2 answers

Problem with a drop-down menu in IE

I have been struggling with this code for quite a few hours now and I have been unable to fix it. This is my CSS for my horizontal navigation: #topmenu { position: relative; width: 690px; left: 270px; top: 11px; } #nav { padding:…
Pateman
  • 2,727
  • 3
  • 28
  • 43
2
votes
2 answers

limiting changes on hover to one div at a time

I have three unordered list each surrounded by a container div (An example is showed below, pretty much the same for all three divs). Each list is a link, and once a user hover over the link, the text in a paragraph should change. I've managed to do…
gables20
  • 496
  • 1
  • 7
  • 22
2
votes
2 answers

How to make tidy ignore TT code in html.tt templates?

I have some TT templates that I want tidy-up a little. I use tidy on the command-line. my command looks like: $ tidy -utf8 --preserve-entities y -indent -wrap 120 file.html.tt Unfortunately if I have code like: [% aoh.unshift({ label => '', value…
Беров
  • 1,383
  • 10
  • 22
2
votes
1 answer

EPUB file generation, cover page

I am generating epub book file, and im stuck with a problem. It doesn't read my cover. Here's the cover.xhtml Am I doing something wrong? IMB documentation over the epub creation tells that the only one I need is cover.html file and a images folder…
artouiros
  • 3,947
  • 12
  • 41
  • 54
2
votes
1 answer

In HTML with XML syntax, can one use elements with namespaces other than HTML, SVG and MathML?

It has long been my understanding that one advantage of the XML syntax for writing HTML documents is that it also permits to include in HTML documents elements with a namespace that is not one of those specified by the HTML standard. For example,…
Olivier Cailloux
  • 977
  • 9
  • 24
1 2 3
99
100