删除重复的xslt / xpath

时间:2013-10-16 17:15:52

标签: xslt sharepoint xpath

下面的XML和xsl按预期选择项目但产生重复我的问题是如果有任何具有相同名称的类别,如何删除重复项?

XML        

    <div><b>Departments:</b>Supevisor</div>
    <div><b>Location:</b> <a >Treausry</a></div>
    <div><b>Cat:</b> <a >Trials</a></div>
    <div><b>Months:</b></div>
    </Documents>


   <Documents>
    <div><b>Departments:</b>Supevisor</div>
    <div><b>Location:</b> <a >Treausry</a></div>
    <div><b>Cat:</b> <a >Best</a></div>
    <div><b>Months:</b></div>
    </Documents>




   <Documents>
      <div><b>Departments:</b>News Week</div>
    <div><b>Location:</b> <a >Treausry</a></div>
    <div><b>Cat:</b> <a >Test 2</a></div>
    <div><b>Months:</b></div>
    </Documents>

       <Documents>

    <div><b>Departments:</b>Senior</div>
    <div><b>Location:</b> <a >Banking</a></div>
    <div><b>Cat:</b> <a >Trials</a></div>
    <div><b>Months:</b></div>
    </Documents>

XSL正在使用

<xsl:for-each select="$Rows">
                <xsl:sort select="@Cat" order="ascending"></xsl:sort>
                <xsl:if test="@Store != '' and @Location != ''">
                    <li>
                        <xsl:choose>
                            <xsl:when test="contains($PageUrl,concat('Store=',@Store, '&amp;','Location=',@Location, '&amp;', 'Months=',@Months))">
                            <div>
                            <a href="{concat('#tabs-',@ID)}">
                    <xsl:value-of select="self::*/@Cat"></xsl:value-of>
                            </a>
                            </div>
                                 </xsl:when>
                        </xsl:choose>
                    </li>
                </xsl:if>
            </xsl:for-each>

立即输出

<documents>
    Supervisor
     Treasury


 Supervisor
     Best


News Week
     Treasury

Senior
     Treasury

预期产出

<documents>
    Supervisor
     Treasury
     Best


News Week
     Treasury

Senior
     Treasury

由于

0 个答案:

没有答案