[Zpt] XHTML validation and <span>
Martijn Pieters
mj@digicool.com
Fri, 9 Mar 2001 15:33:29 +0100
On Fri, Mar 09, 2001 at 09:22:29AM -0500, Todd Coram wrote:
> I may be the only one goofing this up, but XHTML doesn't allow "arbitrary" use of <span>. I have been using spans pretty liberally, but this is illegal:
>
> <span metal:define-macro="something">
> <p> Just something </p>
> <p> That needs to be said... </p>
> </span>
>
> Span cannot contain elements like <p>. It is supposed to only be used for inline-elements. Browsers don't complain and non-validating parsers (like ZPT), don't complain, but I guess I should be doing stuff like:
>
> <div metal:define-macro="something">
> <p> Just something </p>
> <p> That needs to be said... </p>
> </div>
Yup, that'd be the right thing to do. You have to play very carefully with
XML :)
The following is also illegal, for example:
<title>The title is:
<span tal:replace="here/title">object title</span>
</title>
because only text is allowed inside <title>. The solution here is to use a
well-aimed define, like: "python:'The title is: ' + here.title".
--
Martijn Pieters
| Software Engineer mailto:mj@digicool.com
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
---------------------------------------------