开发者

XSLT parsing XML to generate Word document

开发者 https://www.devze.com 2023-01-13 23:15 出处:网络
I have an XLST file that is supposed to parse an XML file and generate Word document. But when I parse it in Vis开发者_运维问答ual Studio it produces another XML because its header is:

I have an XLST file that is supposed to parse an XML file and generate Word document. But when I parse it in Vis开发者_运维问答ual Studio it produces another XML because its header is:

<xsl:output method="xml" omit-xml-declaration="no" version="1.0" encoding="utf-8" standalone="yes" />
<xsl:template match="/">
    <xsl:processing-instruction name="mso-application">
        <xsl:text>progid="Word.Document"</xsl:text>
    </xsl:processing-instruction>

I tried the method= "text" but it generates a plain text with no formatting. what property should I specify so that when I run the transformation it saves the result in a Word document?


Another option might be to simply generate HTML (and specify the output method as HTML) and save the file with a .doc extension.

MS Word will open the file without complaining (though it still knows that it's a web page)

0

精彩评论

暂无评论...
验证码 换一张
取 消