photo 1517420704952 d9f39e95b43e

Almost since childhood I had two dreams: to discover algebraic general topology and to make my own XML standard on automatic conversion between XML namespaces. This article is related to the second topic.

More specifically, this article is about applying my automatic XML transformations to the following problem:

Create my own HTML-standard which is truly extensible, to which it’s easy to add macroses and scripting, for instance.

And yes, I did this. I present here my own HTML standard different of W3C things (and better), because it is truly extensible with my sophisticated power of XML!

What is it?

The first component of the system is:

Automatic Transformations of XML Namespaces

This is a rather complex specification written by me (based on XML and RDF). I encourage you to study it, but if you are lazy or stupid skip it and read on, to use basics of this software you don’t need to know deep details.

The idea is that script which transform between different XML formats are run on the XML document or its fragments in order automatically determined by the XML namespaces and their descriptions located in RDF files. Sounds simple, but the system is quite sophisticated.

The second component of the system is:

XML Boiler

It is a Python program (I am going to rewrite it in D Language, because Python is too slow and D is powerful like Python, but fast.) that implements Automatic Transformations of XML Namespaces specification.

In this article I will teach you the basics of usage of this software.

Extensible Modular Markup (EMM)

It is my new take on rewriting HTML standards in my own way.

It is not compatible with (X)HTML, but you can use XML Boiler to convert from my format to standard HTML.

This EMM in the future will support macroses and Turing complete programming to make your HTML files programmable (just like TeX but better) and replace legacy HTML template languages and even LaTeX in the future.

It does not support Turing-complete programming yet, but already has a few useful features missing in standard HTML.

Now we will consider some of components of this system separately:

XML Boiler

Again, it is a Python program that implements Automatic Transformations of XML Namespaces specification.

You don’t need to know Automatic Transformations of XML Namespaces for basic usage of this program.

Installation

Download it from https://pypi.org/project/xml-boiler/#files and install the Wheel file:

  1. Install Python.
  2. pip install NAME-OF-THE-FILE.whl (or pip3 install NAME-OF-THE-FILE.whl on some platforms such as Debian or Ubuntu Linux). If you run the installation on Unix, you need to run it as root to install the script bin/boiler.

It will also automatically install all the dependencies.

You need also install an XSLT processor (XSLTproc and Saxon Home Edition are supported) and Pygmentize for syntax coloring in HTML support.

Sample XML Files

As of now, as the software is not yet supporting conversion from EMM to XHTML1.0 and XHTML1.1 (to be honest, looks like it will never support this; but don’t worry XHTML2 support is coming!)

Thus the “real” modes of operation are either:

  • EMM to be converted to XHTML2 (but note that browsers don’t yet support XHTML2)
  • a mix of XHTML1.0/1.1 and EMM to be converted to XHTML1.x (in practice, you should use this mode when creating your HTML files)

An example of the second “mode” is:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://portonvictor.org/ns/EMM/basic"
      xmlns:struct="http://portonvictor.org/ns/EMM/struct"
      xml:lang="en">
  <head>
    <title>Virtual Library</title>
  </head>
  <body>
    <struct:p>Moved to <a href="http://example.org/">example.org</a>.</struct:p>
  </body>
</html>

You see, it is an XHTML2 file with some “constructs” from EMM inserted. We use EMM <struct:p> instead of XHTML2 <p>. This example is pointless, as <struct:p> has the same meaning as <p>.

In this mode we support all XHTML2 tags and attributes, but we use our own namespaces. (The element names are the same as in XHTML2, only the namespace prefix is different. See here which namespaces to use.)

The transformation of this file into regular XHTML2 is done by the command:

boiler -i INPUT-FILE.xml -o OUTPUT-FILE.html --preload http://portonvictor.org/ns/base --preload 'http://portonvictor.org/ns/EMM' \
pipe 'c -t https://www.w3.org/2002/06/xhtml2/ -n error + t http://portonvictor.org/ns/base#NSClean'

What does this mean? Don’t ask me, it is a black magic. If you are interested, read XML Boiler documentation and Automatic Transformations of XML Namespaces specification.

You can replace error by ignore, if you want to debug the output which may be not valid XHTML if you mistake in your input file.

As of now, the second mode is not of much use, let’s consider the first mode:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
      xmlns:sections="http://portonvictor.org/ns/EMM/sections"
      xmlns:toc="http://portonvictor.org/ns/EMM/toc"
      xmlns:syntax="http://portonvictor.org/ns/syntax"
      xmlns:comment="http://portonvictor.org/ns/comment">
<head>
    <meta charset="UTF-8"/>
    <title>Documentation</title>
    <link rel="Stylesheet" href="syntax.css"/>
</head>
<body>
    <h1>Our Software</h1>

    <h2>Table of Contents</h2>

    <!-- automatically generated table of contents -->
    <toc:toc/>

    <!-- instead of HTML <hX> tags, need for correct table of contents -->
    <sections:section>
        <sections:h>Prerequisites</sections:h>
        <p>You need to know what is XML and what are XML namespaces before reading this document.</p>
    </sections:section>

    <!-- syntax highlighted if you have
    <pre syntax:format="xml">
&lt;y xmlns:xi="http://www.w3.org/2001/XInclude"&gt;
    &lt;xi:include href="simple.xml"/&gt;
&lt;/y&gt;
    </pre>

    <!-- This tag is removed. -->
    <comment:comment>Some important information.</comment:comment>
    
</body>
</html>

It is a HTML document with some embedded EMM tags. You see, it supports more convenient structuring of the document, table of content, syntax highlighting, etc. Also XInclude for embedding other XML documents is supported. See here for the full list of the supported features. In the future, we will add even macroses and scripting.

The transformation of this file into regular XHTML1.1 is done by the command:

boiler -i INPUT-FILE.xml -o OUTPUT-FILE.html --preload http://portonvictor.org/ns/base pipe \
  'c -t http://www.w3.org/1999/xhtml -n error + t http://portonvictor.org/ns/base#NSClean'

What does this mean? Don’t ask me, it is a black magic. If you are interested, read XML Boiler documentation and Automatic Transformations of XML Namespaces specification.

Things to Do by You

Participate in the development of the specifications and the software! We need full Turing-complete scripting support and many more other features. Get rid of old HTML and LaTeX, go to the future!

Hire me! I do XML, Python, C, Ada, D Language, and many other things.