I am having a lot of data in .xml
files which look like this:
<DATA>
<NAME="name" />
<VERSION="1" />
<VARIABLES>
<TEST>
<ELEMENT atr="0" atr2="1">123456.000000001</ELEMENT>
</TEST>
</VARIABLES>
</DATA>
I have to write a lot of templates reading this data for documentation and I would like to do this with LaTeX. Does any approach exist, to write this data into a .tex
file? I want to write a file, where each {SOMETHING/SOMETHINGELSE}
gets replaced by the XML value. A bonus would be, to get it rounded. As I am using LuaLaTeX, I guess there could be an approach in this language. But any other possibility would be interesting for me, too. Unluckily, I am not the scripting guy, but if you say, I should do this in python (which I would be willing to learn...), I will move this to an other SX-page.
The file would look something like this:
% arara: lualatex
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\section{VolumeFlows}
A variable: $x=\SI{{VARIABLES/TEST/ELEMENT}}{\metre}$
\begin{table}%
\centering
\begin{tabular}{l S}
\toprule
Name & {Value}\\
\midrule
A variable & {VARIABLES/TEST/ELEMENT}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
xml parser lua
on Google?.tex
afterwards. But if I want to distribute the template, a version like cjorssens would be really handy, as I just need to run LuaLaTeX ones.