Common Entities Converted to ML-Macros

Revision History
Revision 0.12006-02-04

Initial draft.


Yesterday I converted ml-macros to an XSLT 1/EXSLT solution. I then promptly realized that it would be nice to have some public macros to use with these scripts, so I went and converted the W3C XML Entity Declarations for Characters used by DocBook, MathML, and XHTML 1/HTML 4.01 to the ml-macro syntax. You can currently find them here, and perhaps someday you'll be able to find them in a more "standard" location. The entity files use a .ent suffix; the corresponding ml-macro files use a .mlm suffix. For a complete list of the macro files available, see Table 1, “Macro Files by Category”.

Table 1. Macro Files by Category

DocBookMathMLXHTML 1/HTML 4.01

The macro names are all the same as the entity names, so for example if you wanted the infinity character, you could do something like the following:

<?ml-macro href="http://infinitesque.net/projects/ml-macro/macros/xhtml1/HTMLsymbol.mlm"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>[[infin]]</title></head>
<body>
  <h1>Infinity: [[infin]]</h1>
  <p>What a concept.</p>
</body>
</html>

Running it through either the XSLT 2 or the XSLT 1/EXSLT version of the script should then retrieve the macro definitions and expand the [[infin]] macro to the proper character reference (&#x221E;), conveniently all without the use of a Doctype declaration (which was the whole point in the first place). And of course, you can use XML Catalogs to resolve the URLs to these macro files (while still using the URLs as identifiers), so you don't have to retrieve them over the net each time you use them (please and thank you).