我想要实现的是从节点获取所有匹配项(参与者)并根据日期对它们进行排序并获得 2 个最旧的匹配项。到目前为止,我已经分别从每个灯具节点获取 2 个匹配项。
<spocosy version="1.0">
<fixtures id="820745" ut="2011-03-01" sport="Football" template="England Premier League" tournament="2010/2011" league="Premier League">
<fixture id="839993" name="Chelsea-Manchester United" date="2011-03-01 20:45:00" round="18" status="Not started">
<participants>
<participant participantid="8455" participantname="Chelsea"/>
<participant participantid="10260" participantname="Manchester United"/>
</participants>
</fixture>
<fixture id="840142" name="Birmingham-West Bromwich" date="2011-03-05 13:45:00" round="29" status="Not started">
<participants>
<participant participantid="8658" participantname="Birmingham"/>
<participant participantid="8659" participantname="West Bromwich"/>
</participants>
</fixture>
<fixture id="840143" name="Bolton-Aston Villa" date="2011-03-05 16:00:00" round="29" status="Not started">
<participants>
<participant participantid="8559" participantname="Bolton"/>
<participant participantid="10252" participantname="Aston Villa"/>
</participants>
</fixture>
</fixtures>
<fixtures id="821290" ut="2011-03-01" sport="Football" template="Spain LIGA BBVA" tournament="2010/2011" league="LIGA BBVA">
<fixture id="875757" name="Espanyol-Mallorca" date="2011-03-01 20:00:00" round="26" status="Not started">
<participants>
<participant participantid="8558" participantname="Espanyol"/>
<participant participantid="8661" participantname="Mallorca"/>
</participants>
</fixture>
<fixture id="875739" name="Sevilla-Gijon" date="2011-03-01 22:00:00" round="26" status="Not started">
<participants>
<participant participantid="8302" participantname="Sevilla"/>
<participant participantid="9869" participantname="Gijon"/>
</participants>
</fixture>
<fixture id="875737" name="Zaragoza-Athletic Bilbao" date="2011-03-02 20:00:00" round="26" status="Not started">
<participants>
<participant participantid="8394" participantname="Zaragoza"/>
<participant participantid="8315" participantname="Athletic Bilbao"/>
</participants>
</fixture>
<fixture id="875743" name="Getafe-Atletico Madrid" date="2011-03-02 20:00:00" round="26" status="Not started">
<participants>
<participant participantid="8305" participantname="Getafe"/>
<participant participantid="9906" participantname="Atletico Madrid"/>
</participants>
</fixture>
<fixture id="875746" name="Villarreal-Hercules" date="2011-03-02 20:00:00" round="26" status="Not started">
<participants>
<participant participantid="10205" participantname="Villarreal"/>
<participant participantid="10278" participantname="Hercules"/>
</participants>
</fixture>
</fixtures>
there are 5 fixtures
<xsl:template match="fixtures">
<xsl:for-each select="//fixture">
<xsl:sort select="@date" data-type="text" order="ascending"/>
<xsl:if test="position() < 3">
<xsl:variable name="eventid" select="@id"/>
<table class="default soccer">
<tbody>
<tr class="finished livestats event_row">
<td class="status tz_field" data-format="short_datetime"><xsl:value-of select="@date"></xsl:value-of></td>
<td class="team_1">
<div class="of_wrapper">
<span />
<xsl:value-of select="//participant[position()=1]/@participantname"></xsl:value-of>
</div>
</td>
<td id="res_{$eventid}" class="result bold link popup">
-
</td>
<td class="team_2">
<div class="of_wrapper">
<span />
<xsl:value-of select="//participant[position()=2]/@participantname"></xsl:value-of>
</div>
</td>
</tr>
</tbody>
</table>
</xsl:if>
</xsl:for-each>
这是它的输出
在该输出中,日期是最旧的 2,这是我想要实现的,但它们一次又一次地为每个装置显示(有 5 个装置,日期总共显示 10 次而不是 2 次)并且团队与日期,团队从第一个参与者节点显示。
我不一定想要确切的代码,任何方法也将不胜感激。所以简单地说,我想获取所有匹配项,然后根据日期对它们进行排序,并显示最旧的 2 个带有确切日期的机器。