I would like to use TeX to typeset Søren Kierkegaard's complete works, which are available online here. It includes a collection of notes in a separate XML file which I would like to add to the document as side notes if possible. This question deals with how one can automatically convert an entire website into LaTeX, but as is also mentioned in the answer, these solutions are far from perfect. What I need is not really a program that automatically converts everything into TeX. Rather, I need a program where I can specify manually specify which LaTeX command each HTML tag must be converted into. For instance, the note reference
<span id="r132"><a class="k" name="r132" href="kom.xml#k132" onclick="return blank('kom',this.href,430)" style="display: inline;">*</a></span>
should be automatically converted into
\Anote{r132}
(cf. this question). Does there exist some software that can convert HTML tags into LaTeX commands in this way?