Making Numerical Algorithms Multi-Language: The XML Engine Layer — A Single Source of Truth


Published 24/02/2026 By nAG

In the first blog in our ‘Inside the Engineering’ series, we explored the challenge at the heart of multi-language numerical software: how do you maintain perfectly consistent interfaces and documentation across many programming environments?

When we faced this problem, our solution was ahead of its time.

Every nAG Library algorithm is described — fully and precisely — in a single XML file.

This Algorithm XML file is far more than a simple parameter list. It captures:

  • The full routine signature
  • Argument names, types, and roles
  • Array dimensions and relationships
  • Error conditions and behaviour
  • Mathematical descriptions
  • Detailed argument-level documentation
  • Metadata describing how each interface maps into different programming languages

Taken together, this XML forms a structured blueprint of both the algorithm and its documentation.

From One XML File, Everything Else Flows

Once the XML format was established, the team built a set of XSLT transformations capable of processing  this information and generating everything required downstream.

  1. Full HTML Documentation
    Clean, consistent, automatically generated pages — one per routine — across all supported languages. Accuracy is guaranteed because the documentation is derived from the same XML used to generate the language wrappers.
  1. Intermediate XML
    A streamlined representation containing only the information required for wrapper generation. This separation keeps the system modular and makes the pipeline easier to maintain and evolve.
  1. Language-Specific Wrapper Code
    From the intermediate XML, XSLT scripts generate wrappers for each supported language:
  • C / C++
  • C#
  • Fortran
  • MATLAB®
  • Java
  • Python

Each wrapper layer is produced reliably, consistently, and predictably — removing opportunities for human error to creep in.

Why XSLT?

XSLT is designed to transform structured documents into other structured documents — exactly the problem wrapper generation presents. In the hands of engineers with expertise in markup, structure, and mathematical typesetting, it becomes a powerful and precise engineering tool.

The nAG team includes globally recognised experts in mathematical typesetting and structured document systems, alongside deep numerical algorithm expertise. Drawing on experience with LaTeX, MathML, XML, and standards-based document engineering, they shaped a pipeline that remains exceptional in both robustness and clarity.

This system didn’t just automate tasks.

It established trust: trust that documentation matches code, that interfaces remain stable, and that behaviour is consistent across languages.

Next time we’ll explore why this kind of trust matters more now than ever.