I know latex, but new in xslt (learning now), I need to convert the tex to xml file through XSLT (one of my friend suggest, but i failed to convert). Please suggest or give example to convert the files.
-
2xslt is a language designed for the other direction, it can read xml it can't read a latex file in any useful way. use a convertor such as latexml or tex4ht to generate xml from latex– David CarlisleCommented Nov 16, 2023 at 9:11
-
Welcome to TeX.SE hope this tex.stackexchange.com/questions/643627/… may helpful for you– MadyYuviCommented Nov 16, 2023 at 9:27
1 Answer
XSLT is a language designed to take XML as input so is not that useful to read latex files although it would be useful to convert an intitial xml conversion to whatever specific xml format you need.
A simple example would be to use make4ht
to generate xhtml formatted XML.
So, using the standard latex example document small2e.tex
which is in the base distribution so you can use
pdflatex small2e
which makes a small2e.pdf
or
make4ht -f xhtml small2e
which makes an xml file small2e.html
which displays in a browser as
Or could be used as the input to an XSLT transformation to convert to a different xml format.