“DTD禁止”调用XslCompiledTransform.Transform()时 [英] "DTD prohibited" when calling XslCompiledTransform.Transform()

查看:124
本文介绍了“DTD禁止”调用XslCompiledTransform.Transform()时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用XSLT将HTML文件转换为XSL-FO。代码如下所示。

I am using XSLT to convert a HTML file to XSL-FO.  The code is shown below.

1 //加载FO样式表。
2 XslCompiledTransform xslt = new XslCompiledTransform();
3 xslt.Load(@ " PDF \xhtml-to-xslfo.xsl" );
4
5 //执行转换并将结果输出到文件。
6 xslt.Transform(htmlFilePath,foFilePath);
7
1// Load the FO style sheet. 
2XslCompiledTransform xslt = new XslCompiledTransform(); 
3xslt.Load(@"PDF\xhtml-to-xslfo.xsl"); 
4 
5// Execute the transform and output the results to a file. 
6xslt.Transform(htmlFilePath, foFilePath); 
7 

推荐答案

以前我使用的是以下HTML。

Previously I was using the following HTML.

< html xmlns = " http:// www。 w3.org/1999/xhtml" >
< ; body >
< table cellpadding = " 0" cellspacing = < font style ="color:blue">" 0" style = " font-size:10px" width = " 100%" ; >
< tr style = < font style ="color:blue">" table-layout:fixed;字体大小:12像素; width:100%" >
< td colspan = " 2" style = < font style ="color:blue">" width:30%" >
& nbsp; < strong > 付款方式编号 < / strong > < / td >
< / tr >
<! - ...更多html来这里...... - >
< / >
< / body >
< / html >
<html xmlns="http://www.w3.org/1999/xhtml" > 
<body>  
<table cellpadding="0" cellspacing="0" style="font-size: 10px" width="100%">  
    <tr style="table-layout: fixed; font-size: 12px; width: 100%">  
        <td colspan="2" style="width: 30%">  
            &nbsp;<strong>Payment No.</strong></td>  
    </tr>  
    <!-- ... more html comes here ... -->  
</table>  
</body>  
</html>  


这篇关于“DTD禁止”调用XslCompiledTransform.Transform()时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆