set @xhtml:dir="rtl" in serialization root node

a html attribute dir at the root node of the fragment will allow browsers to render accordingly.

<xhtml:span id="N4.4.2.4.4.18.2" class="persName annotation">
  <svg></svg>
  <xhtml:span id="Cod_Arab_236_N1.5.3.5.5.19.3.2_1" class="token">سرحادوم</xhtml:span>
</xhtml:span>

will be rendered correctly, as the SVG is in xml ltr direction and afterwards the rtl language starts. image

when we set the proposed @dir="rtl" it will rendered as shown below.

image