我需要做这样的事情
这是我的xml:
<TSRslt>
<TSExpectedResult Expected = "result : 42.7400131226"></TSExpectedResult>
<TSActual Actual = "result : 42.7400131226" Result = "0"></TSActual>
</TSRslt>
<TSRslt>
<TSExpectedResult Expected = "result :xyz"></TSExpectedResult>
<TSActual Actual = "result : xyz" Result = "1"></TSActual>
</TSRslt>
这是我的样式表 xsl:
<TABLE id="table2" class="tl2" cellSpacing="0" cellPadding="2" width="100%">
<TR><TH noWrap = "noWrap" class="br">Expected</TH>
<TH noWrap = "noWrap" class="br">Actual</TH>
</TR>
<TR>
<xsl:for-each select="TSRslt">
<TR><TD class="br2" width="50%"><xsl:for-each select="TSExpectedResult"><xsl:value-of select="@Expected" /></xsl:for-each></TD>
<TD class="br2" width="50%"><xsl:for-each select="TSActual">
<xsl:if test="@Result = '0'">
<FONT COLOR = "#000000">
<xsl:value-of select="@Actual" />
</FONT>
</xsl:if>
<xsl:if test="@Result = '1'">
<FONT COLOR = "#000000">
<xsl:value-of select="@Actual" />
</FONT>
</xsl:if>
</xsl:for-each></TD>
</TR>
</xsl:for-each>
</TR>
</TABLE>
但是我的xml不是那样的。它的标签顺序如下:
<TSExpectedResult Expected = "result : -32.60900"></TSExpectedResult>
<TSExpectedResult Expected = "result : -32.60900"></TSExpectedResult>
<TSActual Actual = "result : -32.60900" Result = "0"></TSActual>
<TSActual Actual = "result : -32.60900" Result = "0"></TSActual>
我有太多的 xml 文件,因此我无法更改所有标签的顺序。如何使用此订单填写表格:
Expected Results Actual REsults
1 4
2 5
3 6