Topic: HTML to XHTML: end tag for empty element
Greetings,
I am trying to convert HTML code to XHTML but i can not transform <input/> to <input></input>. Any help?
You are not logged in. Please login or register.
PHP Labware forum → htmLawed → HTML to XHTML: end tag for empty element
Greetings,
I am trying to convert HTML code to XHTML but i can not transform <input/> to <input></input>. Any help?
Empty elements in XHTML, like 'input', either have an end tag ('</input>') or their start tags end with ' />'. The latter is recommended (http://www.w3.org/TR/xhtml1/#guidelines), and htmLawed uses such a rule.
If you really need end tags for all empty elements, you can further modify the htmlawed output, e.g., with:
$out = htmLawed($in, ...);
$out = preg_replace('`<([a-z]+)([^>]*?) />`', '<\\1\\2></\\1>', $out);PHP Labware forum → htmLawed → HTML to XHTML: end tag for empty element