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

dojoType alternative

I want to avoid dojoType for 2 reasons: parseonload makes it "jump" onload (you see system-default input-fields for some time onload) It is not validating…
iceteea
  • 1,214
  • 3
  • 20
  • 35
2
votes
1 answer

Primefaces Datatable JSF2.0

Well Ive been developing a JSF interface, and using primefaces have managed to create two datatables which pull data from an SAP / oracle ondemand crm system. However all is not going so smooth, Im having trouble with the datatable in a number of…
reggie morgan
  • 51
  • 1
  • 2
  • 11
2
votes
1 answer

Does it matter which ' and " marks are used?

Possible Duplicate: When to Use Double or Single Quotes in JavaScript Are single quotes valid in HTML/XHTML? In the world of XHTML, HTML, Javascript etc. does it matter if you use ' or " when writing code as long as you stick to one or the other?…
L84
  • 45,514
  • 58
  • 177
  • 257
2
votes
2 answers

Overlapping image in photoshop splice, how to float with CSS

Here is the site I am working on: http://graves-incorporated.com/test_sites/solera2012/test/home-pg.html My problem is the red box in the top right corner. I spliced up the site is photoshop but since that part overlaps I needed to split the image…
Dan Graves
  • 347
  • 2
  • 4
  • 14
2
votes
1 answer

How does HTML5 support RDFa?

I like to publish contont in both RDF format and HTML formats. So, there is a specific encoding for HTML with RDFa. Yet there are so many benefits to HTML5 that I like. But there is no mechanism for specifying RDFa within HTML5. Are there any…
Bruce Whealton
  • 1,051
  • 2
  • 14
  • 25
2
votes
3 answers

XHTML to XML XSLT conversion

I am doing a very simple xslt to convert a html page to a xml file. But it appears to me that the starting point is not that straightforward to me.My first goal is to convert a tag into a tag. I did the following xslt:
Kevin
  • 6,711
  • 16
  • 60
  • 107
2
votes
1 answer

How to XSLT-Transform a XHTML-Dokument with IE-conditional-comments?

I transform a XHTML dokument to another XML-Dokument with XSLT. In the XHTML-Input-Dokument there are several IE-conditional-comments, like this one: But while…
bceo
  • 319
  • 1
  • 3
  • 5
2
votes
2 answers

Odd HTML/XML encoding issue

I'm having some real issues with a site we're building on our bespoke content management system. The system renders all views via XSLT, which may be the problem. The problem we're experiencing appears to be the result of character encoding…
Chris Disley
  • 1,286
  • 17
  • 30
2
votes
3 answers

XHTML validation: character "" not allowed in prolog. Why?

Why doesn't this page validate? http://www.jethroweb.nl/test/test.php I think the XHTML code is okay, but the W3C Markup Validation Service and the WDG HTML Validator do not agree. UPDATE: The XHTML code is generated by PHP, this are the first lines…
waanders
  • 8,907
  • 22
  • 70
  • 102
2
votes
1 answer

How do I parse HTML which includes named ISO-8859-1 entities with Python?

I summarize: minidom appears not to like 8859 named entities; what's an appropriate resolution? Here's code which illustrates my situation: sample = """

Un ejemplo

Me llamo Juan Fulano y…

Cameron Laird
  • 1,067
  • 5
  • 9
2
votes
3 answers

Font Styling Issue ~ how to make font smooth/Strong in html css

I have Font Verdana + Bold + 16pt + Stong in PSD So In html Conversion, we have Font-family: Verdana + Font-weight:bold + Font-Size:16pt + What for Strong ? (strong html tag is not working for this ) there are 5 Font Styles there in PSD Sharp ,…
Anne
  • 59
  • 2
  • 3
  • 6
2
votes
1 answer

Can I use custom xml namespace in ePub 3.0?

An error comes out by epub which uses custom namespaces in ePubChecker. Is using custom namespaces in ePub 3.0 forbidden? example code:
ANNotunzdY
  • 379
  • 1
  • 3
  • 14
2
votes
3 answers

Question about rendering .tiff image in HTML

In my html page, I created an tag to render some of my .tif format images. Since .tif images can not be rendered directly in "src" attribute of the tag, so I created the following code to render it:
Kevin
  • 6,711
  • 16
  • 60
  • 107
2
votes
1 answer

Changing the selected Menu items class across pages

For my website project I am using ASP.NET MVC "Razor". Learning as I go. I have 5 or 6 pages on my site, and one page that is on another site. I want users to feel like they are using the same site for all. There is a typical HTML menu for the…
tig
  • 3,424
  • 3
  • 32
  • 65
2
votes
3 answers

html form value before and value after

I wondered if this was possible: It looks like this: Full Name: But I wanted to get rid of the Full Name…
MOTIVECODEX
  • 2,624
  • 14
  • 43
  • 78