在
if
@Timestamp
比上一个小
Message
<xsl:for-each select="Message">
<xsl:sort select="position()" data-type="number" order="descending"/>
<xsl:variable name="newclass">
<xsl:if test="@Timestamp + 60 > $ctimestamp">new</xsl:if>
</xsl:variable>
<tr><td class="debugtime">
<xsl:value-of select="@Time"/>
</td><td class="{$newclass}">
<xsl:value-of select="node()"/>
</td></tr>
</xsl:for-each>
示例XML
<Message Time="2010/06/17 04:23:32" Timestamp="1276773812">message1</Message>
<Message Time="2010/06/17 04:23:32" Timestamp="1276773812">message2</Message>
<Message Time="2010/06/17 04:23:33" Timestamp="1276773813">message3</Message>
<Message Time="2010/06/17 04:23:33" Timestamp="1276773813">message4</Message>
更新:
下面是块代码。
<xsl:if test="@Timestamp + 60 > $ctimestamp">
<xsl:if test="position() = 1">
new
</xsl:if>
<xsl:if test="position() != 1 and ../Message[position()-1]/@Timestamp - 1 < @Timestamp">
new
</xsl:if>
</xsl:if>