我有一个SSIS XML任务,我正在尝试将一些XML输出重新格式化为漂亮的HTML。这是XML
<RootNode><row><ProcessName>RefreshDbnSr1FromP01</ProcessName><StartDateAndTime>2011-09-21T15:13:56</StartDateAndTime><AverageSeconds>2562</AverageSeconds></row><row><ProcessName>RefreshDbnSr1FromP01</ProcessName><StartDateAndTime>2011-09-21T15:29:45</StartDateAndTime><AverageSeconds>2562</AverageSeconds></row><row><ProcessName>RefreshDbnSr1FromP01</ProcessName><StartDateAndTime>2011-09-21T15:44:07</StartDateAndTime><AverageSeconds>2562</AverageSeconds></row></RootNode>
然后这是我用来转换的XSLT。
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/RootNode">
<html>
<body>
<table border="1">
<tr bgcolor="#AAAAAA">
<th>ProcessName</th>
<th>StartDateAndTime</th>
<th>AverageSeconds</th>
</tr>
<xsl:for-each select="row">
<tr>
<td>
<xsl:value-of select="ProcessName" />
</td>
<td>
<xsl:value-of select="StartDateAndTime" />
</td>
<td>
<xsl:value-of select="AverageSeconds" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
它似乎在IE中运行良好。 (如果我添加标题它可以工作。)但XML任务导出的输出看起来像这样。
<?xml version="1.0" encoding="utf-8"?>RefreshDbnSr1FromP012011-09-21T15:13:562562RefreshDbnSr1FromP012011-09-21T15:29:452562RefreshDbnSr1FromP012011-09-21T15:44:072562
感谢任何帮助。
谢谢,
答案 0 :(得分:2)
尝试在元素之前将以下行添加到XSLT:
<xsl:output method="html" indent="yes"/>
请参阅此博客文章中的示例样式表: http://geekswithblogs.net/LifeLongTechie/archive/2011/02/02/using-ssis-to-send-a-html-e-mail-message-with-built-in.aspx