Ok, I think that this is because in my changes to make stuff more mobile-friendly, I introduced HTML5 stuff.
The build system generates HTML with an XHTML 1.0 Strict DOCTYPE and validates using DTD-based XML validation. The actual output already uses HTML5 features (aria-* attributes, inline SVG, modern content models in <button>), causing validate-xhtml to fail on every generated page. I think the solution is the below, but proposing it here for sanity check before YOLO’ing it, because it’s a significant change. The below patch: 1. Switches the output method from "xml" to "html" and emits <!DOCTYPE html> instead of the XHTML 1.0 Strict DOCTYPE. 2. Replaces the Ant <xmlvalidate> target with vnu.jar (W3C Nu HTML Checker) for HTML5 validation. 3. Removes xml:lang from <html> elements (redundant in HTML5; lang= suffices). 4. Removes the XHTML namespace from common.xsl (not needed for HTML output method). === 1. style/xsl/language.xsl — output method and doctype === The xsl:output element is generated dynamically by language.xsl for each per-language stylesheet. Currently sets method="xml" and emits XHTML 1.0 Strict public/system identifiers. Switch to method="html" and use the "about:legacy-compat" system identifier, which is the W3C-blessed way to emit a valid HTML5 DOCTYPE from XSLT 1.0 processors. Browsers treat <!DOCTYPE html SYSTEM "about:legacy-compat"> identically to <!DOCTYPE html>. See: https://www.w3.org/TR/html5/syntax.html#the-doctype If your XSLT processor emits a bare <!DOCTYPE html> without doctype-system (xsltproc does), you can omit it entirely. Test locally. --- a/docs/manual/style/xsl/language.xsl +++ b/docs/manual/style/xsl/language.xsl @@ -408,10 +408,7 @@ <xsl:element name="xsl:output"> <xsl:attribute name="method"> <xsl:choose> - <xsl:when test="$type = 'manual' or - $type = 'chm' or - $type = 'zip'"> - <xsl:text>xml</xsl:text> + <xsl:when test="$type = 'manual'"> + <xsl:text>html</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>text</xsl:text> @@ -444,17 +441,5 @@ </xsl:attribute> <xsl:attribute name="indent">no</xsl:attribute> - <xsl:if test="$type = 'manual' or - $type = 'chm' or - $type = 'zip'"> - <xsl:attribute name="doctype-public"> - <xsl:text>-//W3C//DTD XHTML 1.0 Strict//EN</xsl:text> - </xsl:attribute> - </xsl:if> - <xsl:if test="$type = 'manual'"> - <xsl:attribute name="doctype-system"> - <xsl:text>http://www.w3.org/TR/xhtml1/DTD/</xsl:text> - <xsl:text>xhtml1-strict.dtd</xsl:text> - </xsl:attribute> - </xsl:if> - <xsl:if test="$type = 'chm' or - $type = 'zip'"> - <xsl:attribute name="omit-xml-declaration">yes</xsl:attribute> - </xsl:if> + <xsl:if test="$type = 'manual'"> + <xsl:attribute name="doctype-system">about:legacy-compat</xsl:attribute> + </xsl:if> </xsl:element> === 2. style/xsl/common.xsl — remove XHTML namespace === With method="html", elements should be in no namespace (plain HTML). --- a/docs/manual/style/xsl/common.xsl +++ b/docs/manual/style/xsl/common.xsl @@ -27,3 +27,3 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns="http://www.w3.org/1999/xhtml"> + xmlns=""> === 3. All page-type XSL files — remove xml:lang === Remove xml:lang="{$doclang}" from <html> elements. The lang= attribute alone is sufficient in HTML5. --- a/docs/manual/style/xsl/manualpage.xsl +++ b/docs/manual/style/xsl/manualpage.xsl @@ -32 +32 @@ -<html xml:lang="{$doclang}" lang="{$doclang}"> +<html lang="{$doclang}"> Same one-line change in: - indexpage.xsl (line 51) - faq.xsl (line 32) - directiveindex.xsl (line 32) - moduleindex.xsl (line 32) - overrideindex.xsl (line 39) - sitemap.xsl (line 32) - quickreference.xsl (line 32) - synopsis.xsl (line 33) === 4. build/build.xml — replace validate-xhtml target === Replace <xmlvalidate> with the W3C Nu HTML Checker (vnu.jar). Download: https://github.com/validator/validator/releases --- a/docs/manual/build/build.xml +++ b/docs/manual/build/build.xml @@ -121,7 +121,17 @@ <target name="validate-xhtml" description="- validates all (X)HTML result files"> - <xmlvalidate lenient="false" failonerror="false" warn="true"> - <xmlcatalog refid="w3c-catalog" /> - <fileset dir="../" includes="**/*.html.*"> - <patternset refid="scratch" /> - </fileset> - </xmlvalidate> + <!-- HTML5 validation using W3C Nu HTML Checker (vnu.jar). + Download from https://github.com/validator/validator/releases + and place in build/ or set vnu.jar property. --> + <property name="vnu.jar" value="vnu.jar" /> + <echo message="Validating HTML5 with Nu HTML Checker..." /> + <apply executable="java" failonerror="false" parallel="true" + maxparallel="50"> + <arg value="-jar" /> + <arg value="${vnu.jar}" /> + <arg value="--skip-non-html" /> + <fileset dir="../" includes="**/*.html.*"> + <patternset refid="scratch" /> + </fileset> + </apply> </target> === SUMMARY === Files to modify: - docs/manual/style/xsl/language.xsl (output method + doctype) - docs/manual/style/xsl/common.xsl (default namespace) - docs/manual/style/xsl/manualpage.xsl (xml:lang removal) - docs/manual/style/xsl/synopsis.xsl (xml:lang removal) - docs/manual/style/xsl/indexpage.xsl (xml:lang removal) - docs/manual/style/xsl/faq.xsl (xml:lang removal) - docs/manual/style/xsl/directiveindex.xsl (xml:lang removal) - docs/manual/style/xsl/moduleindex.xsl (xml:lang removal) - docs/manual/style/xsl/overrideindex.xsl (xml:lang removal) - docs/manual/style/xsl/sitemap.xsl (xml:lang removal) - docs/manual/style/xsl/quickreference.xsl (xml:lang removal) And in the build tree: - docs/manual/build/build.xml (validate-xhtml target) New dependency: - vnu.jar (W3C Nu HTML Checker) for build-time validation Generated output changes (before/after): BEFORE: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> AFTER: <!DOCTYPE html SYSTEM "about:legacy-compat"> <html lang="en"> Side effects of method="html": - No XML declaration (<?xml ...?>) — good, it triggered quirks mode in old IE anyway - Void elements use <br> <hr> <meta ...> <img ...> instead of <br/> <hr/> <meta .../> <img .../> — correct HTML5 - No xmlns attribute on <html> — correct HTML5 Rendering impact: Zero. All modern browsers already treated the XHTML Strict pages in standards mode, same as HTML5. === TESTING === 1. Apply patch, rebuild one language: ./build.sh en 2. Inspect generated .html — verify DOCTYPE is HTML5 3. Run: java -jar vnu.jar --skip-non-html ../bind.html.en.utf8 4. Confirm void elements are not self-closed (<br> not <br/>) 5. Spot-check pages render identically in browser --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
