0

下面的 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

谢谢

4

0 回答 0