[Ur] Howto make urweb generate invalid XHTML code?
Marc Weber
marco-oweber at gmx.de
Sat Dec 11 18:48:37 EST 2010
Embed the result of this function into your xml. Eg
fun lis lis =
<xml>
<ul id="otnh">
{ List.mapX (fn (i) => <xml><li>{[i]}</li></xml>) lis }
</ul>
</xml>
embed this xml into your main xml code:
<xml>
{lis (Nil: list int)}<br/>
</xml>
Eg try this validator:
http://validator.w3.org/check?uri=http%3A%2F%2Fmawercer.de%2F%7Emarc%2Ftest.html&charset=%28detect+automatically%29&doctype=Inline&group=0
(The html file was generated and uploaded to my server previously)
What's the issue?
<ul></ul>
without <li> tags is not allowed according to XHTML.
I agree that its very hard / impossible to check. Eg this would require
special list types which ensure having at least one element or
generating different HTML eg
0 elements:
<ul>
<li>no elements</li>
</ul>
vs 1+ elements:
<ul>
<li>first element</li>
</ul>
Without such different handling for the empty list case you end up
trying to proof this case:
items <- queryCol (a sql query);
return <xml>
{lis items}
</xml>
whose validness depends on the state of the database.
I don't want to blame ur. I'm glad that it makes an exception.
Anyway I think the manual should tell about such corner cases. ur/web
should be honest to its users if possible. A footnote would be good
enough.
So I don't consider this a being a bug of Ur - but of its documentation.
How do you think about this?
Marc Weber
More information about the Ur
mailing list