let $errors := <ul>{
for $file in $files
return try{
let $validate := validate:dtd($file, $dtd-file-path)
return <li style="color:green">Ye!</li>
}
catch * {
let $error-description := $err:description
return if (contains (normalize-space($error-description),
normalize-space('Attribute ""xmlns"" must be declared for element type'))
or contains (normalize-space($error-description),
normalize-space('Attribute ""xmlns:xsi"" must be declared for element type')))
(: The 'xmlns' error is introduced by BaseX, and does not get exported to static content, so we ignore it :)
then ()
else if (contains (normalize-space($error-description),
normalize-space('Attribute ""content"" is required and must be specified for element type ""meta""')))
then () (: No longer true in HTML5 :)
else <li style="color:red;">
<p>File '{$file/base-uri()}' doesn't validate against {$dtd-file-path}.</p>
<p>{'Error [' || $err:code || ']: ' || $err:description}</p>
</li>
}
}</ul>
(:let $debug := file:write('debug-in-fix-validation.xml', $errors):)
return <ul>{$errors//li[contains(@style, 'color:red;')]}</ul>