Create a Catalog for XHTML on OS X

While trying to validate the output of cl-blog-generator I needed a local DTD for XHTML. The textproc/xmlcatmgr package in Darwin Ports creates a catalog at /opt/local/etc/xml/catalog, but it does not include XHTML. A flattened XHTML DTD can be found in the w3 validator library and installed the DTD's under /opt/local/share/xml/, but I couldn't find a catalog file for it. It turns out it is pretty simple to write the catalog file; the Wikipedia XML Catalog entry has an example that contains what is needed. Save the example next to the XHTML DTD's as catalog.xml and adjust the paths, then add a "nextCatalog" entry in /opt/local/etc/xml/catalog pointing at the catalog.xml file.

Now I can use (setf cxml:*catalog* (cxml:make-catalog '("/opt/local/etc/xml/catalog"))) and CXML will use the local DTD specified in the catalog.