xsl-list
[Top] [All Lists]

Re: xsl grabbing specific data

2004-09-10 08:36:36
Hi Dan,

Muenchian grouping is a method you can use to remove duplicates,
full explanation here:
http://www.jenitennison.com/xslt/grouping/muenchian.html

Your input looks like

    <file-acl-list>
        <file-acl name="C:\WINDOWS\system32\compmgmt.msc">
            <ace trustee="XPTEST\Users" ... />
            <ace trustee="XPTEST\Power Users" ... />
            <ace trustee="XPTEST\Administrators" ... />
            <ace trustee="SYSTEM" ... />
        </file-acl>
        <file-acl name="C:\boot.ini">
            <ace trustee="XPTEST\Administrators" ... />
        </file-acl>
        <file-acl name="C:\autoexec.bat">
            <ace ... />
        </file-acl>
        ...
    </file-acl-list>

With the Muenchian method you can use a key like

    <xsl:key name="files" match="//file-acl-list/file-acl" use="@name"/>

to "group" the file-acl elements by their @name, by (for-each or template)

    select="//file-acl-list/file-acl[count(. | key('files', @name)[1]) = 1]"

That would give you a list without duplicates. Of course, case sensitive...
if you want a case insensitive comparison, you can replace "@name" with
"translate(@name, $upper, $lower)", both in the key's use attr, and in the 
for-each's select attr. 

HTH,
Anton Triest

----- Original Message ----- 
From: "tom jones" <h8_bsod(_at_)yahoo(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, September 09, 2004 10:49 PM
Subject: Re: [xsl] xsl grabbing specific data


Sorry for not being clear. I mean duplicates in the
original input. What is Muenchian Grouping?

Thanks,

Dan



<Prev in Thread] Current Thread [Next in Thread>