使用XSL显示嵌入在XML文件中的PDF

时间:2016-07-15 11:56:31

标签: xml pdf xslt

我有一个XML文件,其中包含nonXMLBody节点中的PDF流。

<nonXMLBody><text mediaType="application/pdf" representation="B64">JVBERi0xLjQNCiXT9MzhDQoxIDAgb2JqDQo8PCA+Pg0KZW5kb2JqDQoyIDAgb2JqDQo8PCAvVHlwZSAvQ2F0YWxvZw0KICAgL1BhZ2VzIDMgMCBSDQogICAvUGllY2VJbmZvIDw8IC9FT1BERiA8PCAvVmVyc2lvbiAoNC4wLjUwLjIpIC9GbGFncyAxID4+DQogICAgPj4NCj4
...
DAwMDAwIG4NCjAwMDAwNTczMzAgMDAwMDAgbg0KMDAwMDA1NzU5OCAwMDAwMCBuDQowMDAwMDU3ODgzIDAwMDAwIG4NCjAwMDAwNjkxNjkgMDAwMDAgbg0KMDAwMDA2OTU1MSAwMDAwMCBuDQp0cmFpbGVyDQo8PCAvUm9vdCAyIDAgUg0KICAgL0luZm8gMSAwIFINCiAgIC9JRCBbPDA5NTZGNDk2MUU5QzI4MUYyMEY5RjEzQUI1MUY4QzU5PiA8MDk1NkY0OTYxRTlDMjgxRjIwRjlGMTNBQjUxRjhDNTk+XQ0KICAgL1NpemUgMjENCj4+DQpzdGFydHhyZWYNCjcwMzg1DQolJUVPRg0K</text></nonXMLBody>

是否有办法使用XSL模板将pdf AS显示为PDF格式,如果它是纯文本格式的那样,

<xsl:template match='n1:component/n1:nonXMLBody'>
    <xsl:choose>
        <!-- if there is a reference, use that in an IFRAME -->
        <xsl:when test='n1:text/n1:reference'>
            <IFRAME name='nonXMLBody' id='nonXMLBody' WIDTH='80%' HEIGHT='600' src='{n1:text/n1:reference/@value}'/>
        </xsl:when>
        <xsl:when test='n1:text/@mediaType="text/plain"'>
            <pre>
                <xsl:value-of select='n1:text/text()'/>
            </pre>
        </xsl:when>
        <xsl:otherwise>
            <CENTER>Cannot display the text</CENTER>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

或者我是否需要使用其他内容才能让它显示在页面上并在xsl模板中排除nonXMLBody?

由于

0 个答案:

没有答案