Indeed TyXML can generate XHTML trees with svg elements.
But how to use that to update the DOM from JS generated by js_of_ocaml?
# echo > toto.ml <<EOF
let svg = Dom_svg.createSvg Dom_html.window##document
EOF
# ocamlfind ocamlc -syntax camlp4o -package "js_of_ocaml js_of_ocaml.syntax" -c toto.ml
Error: This expression has type Dom_html.document Js.t
but an expression was expected of type Dom_svg.document Js.t
Type
Dom_html.document = (... yanked for sanity ...)
is not compatible with type
Dom_svg.document = (... yum yum ...)
The second object type has no method anchors
Apparently that's a known issue of js_of_ocaml:
https://github.com/ocsigen/js_of_ocaml/issues/276
that I don't know how to work around nicely, may be because I have no idea how
js_of_ocaml interacts with tyxml. I guess you are the pveber of that discussion
so probably you can shed some light on this?