2016-07-27 50 views
0

我想将XML转换为HTML并通过emil发送此html。 我为使用XSL转换来传递XML到HTML但似乎我得到一个问题,室内用XSL文件 这是我的XML文件PDI XSL转换失败:无法编译样式表

<?xml version="1.0" encoding="UTF-8"?> 
<Reports> 
    <Report><PRODUCT>googleDFD </PRODUCT> </Report> 
    <Report><PRODUCT>dm.scores_url</PRODUCT> </Report> 
    <Report><PRODUCT>dm.scores_url</PRODUCT> </Report> 
</Reports> 

和我的XSL文件看起来像这样

<xsl:stylesheet version="2.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:output method="xml" indent="yes" encoding="UTF-8"/> 
<xsl:template match="/Reports"> 
    <html> 
    <head> 
    <title>REPORTS</title> 
     <style> 
     table{ 
     width:40%; 
     } 
     table, th ,td{ 
      padding: 5px; 
      text-align: left; 
     } 
     </style> 
    </head> 
    <body> 
    <h1>REPORT</h1> 
    <table> 
     <tr bgcolor="#9acd32"> 
      <td>Reports</td> 
     </tr> 
    <td> 
     <xsl:apply-templates select ="Report"> 
     </xsl:apply-template> 
    </td> 
    </table> 
</body> 
    </html> 
</xsl:template> 

<xsl:template match ="Report"> 
    <tr> 
     <td><xsl:value-of select="PRODUCT"/></td> 

    </tr> 
</xsl:template> 
</xsl:stylesheet> 

当我运行作业转换这个xml文件的HTML我得到这个错误 enter image description here

+0

我得到这个错误 XML到HTML - 错误:无法编译样式表。检测到1错误 –

+1

请将完整的错误*文本*复制/粘贴到问题的正文中。 –

回答

0

正确

<xsl:apply-templates select ="Report"> 
     </xsl:apply-template> 

<xsl:apply-templates select="Report"/> 
+0

非常感谢你的工作! –