Page 1 of 1

PHP - Transform HTML to valid XHTML

Posted: Mon Nov 11, 2002 7:08 am
by phpante
Does anybody have a script that takes a string of HTML as input and transforms the string and outputs a string containing valid XHTML.

I have an WYSIWYG-editor that produce code as

Code: Select all

<FONT COLOR=#FF0000>hello!</FONT>
but I want to transform the code to be valid XHTML i.e

Code: Select all

<font color="#FF0000">hello!</font>
.

Anybody got any idea?



Thanks,
Andreas :D

Posted: Mon Nov 11, 2002 7:12 am
by twigletmac
Which editor are you using, Dreamweaver can be set so that it overrides the case of the attributes in the HTML. As for scripts, have you checked hotscripts.com?

On a side note, the <font> tag is deprecated in XHTML - you should be using CSS instead if you want your code to validate.

Mac

Posted: Mon Nov 11, 2002 8:09 am
by volka
http://www.w3.org/People/Raggett/tidy/
HTML tidy can (amongst other features) transform most html-documents into valid xhtml.