The itemscope attribute in XHTML

At work we're using xmllint to syntax check TYPO3 Fluid template files. Sometimes microdata attributes like itemscope are used which don't have a value - and xmllint bails out because <div itemscope> is not well-formed:

$ xmllint --noout file.html
file.html: 26: parser error: Specification mandate value for attribute itemscope

What now?

Specifications!

The microdata specification's itemscope section says:

The itemscope attribute is a boolean attribute.

A boolean attribute may actually have values:

If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.

Solution

So both the following variants are correct:

<div itemscope="">...</div>
<div itemscope="itemscope">...</div>

Written by Christian Weiske.

Comments? Please send an e-mail.