Change your xsl:output
element to output XML:
<xsl:output method="xml" indent="yes"/>
(The indent="yes"
part isn't required but will help with reading the output.)
If the xsl:output method="xml"
change alone does not work, try explicitly closing the img
element. So, instead of <img/>
, use <img></img>
:
<img width="100" height="100" src="http://thumbs.dreamstime.com/x/sun-logo-6350903.jpg" border="0" class="MyImage"></img>
Explanation: HTML plays fast and loose wrt end tags. Downstream processing by docx4j wants properly terminated elements, and XSLT will generate properly terminated elements when you specify <xsl:output method="xml"/>
.