FWIW, I've done some LyX->LyXHTML->XML conversions, as well as LyX->XML via Python (to fix text styling open/close mismatching) and then XSLT.
You can find that work here: https://github.com/nicowilliams/lyx2rfc It's a bit old and rotted, but it illustrates something like LaTeX->XML, but for LyX in particular.