I have an XML document to which i need to add below Mime Boundary. Can someone please let me know how we can do this in XSL. Please note that the Mime Boundary is always going to be static and there won't be any attachments in XML. We just need the boundaries around the XML
MIME-Version: 1.0
Content-Type: multipart/Related; type="text/xml"; boundary=_MIME-Boundary
--_MIME-Boundary
content-type: text/xml
Content-ID: BodyPart
Content-Transfer-Encoding: 7bit
<My XML Goes here>.....
--_MIME-Boundary--
Thanks
Try:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:text>MIME-Version: 1.0
Content-Type: multipart/Related; type="text/xml"; boundary=_MIME-Boundary
--_MIME-Boundary
content-type: text/xml
Content-ID: BodyPart
Content-Transfer-Encoding: 7bit
</xsl:text>
<xsl:copy-of select="."/>
<xsl:text>
--_MIME-Boundary--</xsl:text>
</xsl:template>
</xsl:stylesheet>
Note that the encoding applied by the XSLT may not match the MIME declaration.