需要XSLT才能将数据添加到HTML文件的末尾

时间:2017-08-09 20:26:30

标签: html xslt

这是创建当前HTML输出的底部部分:

<p style="margin-top: 0px; margin-bottom: 0px;">Agreed and accepted,</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<table width="200" border="0" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">__________________________________________________</p>
</td>
<td>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">________________________________________</p>
</td>
</tr>
<tr>
<td>FirstName LastName</td>
<td>Date</td>
</tr>
</tbody>
</table>

我需要XSLT在类似于下面的FirstName LastName Date字段之后为eSigIPAddress和eSigDate添加数据变量值:

<p style="margin-top: 0px; margin-bottom: 0px;">Agreed and accepted,</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<table width="200" border="0" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">__________________________________________________</p>
</td>
<td>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">________________________________________</p>
</td>
</tr>
<tr>
<td>FirstName LastName</td>
<td>Date</td>
<td>$eSigIPAddress</td>
<td>$eSigDate</td>
</tr>
</tbody>
</table>

1 个答案:

答案 0 :(得分:1)

Try the below:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">    
    <xsl:template match="/table/tbody/tr/td">
        <xsl:copy>
            <xsl:apply-templates select="@*|Date"/>
        </xsl:copy>
        <td>$eSigIPAddress</td>
        <td>$eSigDate</td>
    </xsl:template>
</xsl:stylesheet>