xslt 1.0排序组的在前同级。

我需要基于已排序组中的先前同级来运行条件操作。我知道在前同级函数作用于原始文档,而不是排序的结果。有没有一种方法可以处理已排序的结果列表?我认为不需要muenchian分组方法,因为我不想基于先前的兄弟进行分组。 给定下面的xml,我想按容器的值排序,然后测试以查看在先兄弟姐妹的type属性(在排序结果内)是否不同,如果是的话,我需要输出新的值@type,但我不希望结果按@type排序。 XML格式
<c>
     <did>
        <container id=\"cid1059023\" type=\"Box\">C 3</container>
        <container id=\"cid1059004\" type=\"Map-case\">C 1</container>
        <container id=\"cid1059002\" type=\"Binder\">OSxxx-3</container>
        <container id=\"cid1059042\" type=\"Box\">OSxxx-1</container>
     </did>
 </c>
<c>
     <did>
        <container id=\"cid1059025\" type=\"Box\">C 4</container>
        <container id=\"cid1059006\" type=\"Map-case\">C 2</container>
     </did>
 </c>
XSL
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
    xmlns:xd=\"http://www.oxygenxml.com/ns/doc/xsl\" version=\"1.0\">
    <xsl:template match=\"/\">
        <table>
            <xsl:for-each select=\"child::*/container[@id]\">
                <xsl:sort select=\".\"/>
                <tr>
                   <td class=\"container\">
                       <xsl:if test=\"@type != preceding-sibling::*/@type\">
                           <xsl:value-of select=\"@type\"/>
                       </xsl:if>
                       <xsl:value-of select=\".\"/>
                    </td>
                </tr>
            </xsl:for-each> 
        </table>
    </xsl:template>
</xsl:stylesheet>
谢谢。     
已邀请:
我不知道如何在不使用扩展的情况下使用XSLT 1.0进行此操作。因此,我将使用XSLT 2.0,或者,如果有人用枪指着你大喊大叫,那么您将使用XSLT 1.0,那么您可以创建一个包含两个XSLT步骤的管道,第一步进行排序,然后进行过滤一秒。     

要回复问题请先登录注册