VBScript and Xpath excluding duplicates

674 views Asked by At

I am trying to pull names from an XML Document using a vbscript.

XML Document structure

<Aliases>
    <Alias PartyType="DF" CaseID="000000" NameType=""> Name Name</Alias>
    <Alias PartyType="DF" CaseID="000000" NameType=""> Name Name</Alias>
    <Alias PartyType="DF" CaseID="000000" NameType=""> Name Name</Alias>
    ...
</Aliases>

the XML File might have 100 rows with the same name coming from several different CaseID's because for this part of my vbscript I am trying to pull all the different Names from all cases, but here is the issue, I don't want to return duplicates.

is there a way to do this with an xPath Expression or should I try to do this with VBScript?

UpDate

using the answer below I am now getting the following error

msxml3.dll: Expected token ')' found ':'.

Aliases/Alias[@PartyType='DF' and not(./text() = preceding-sibling-->:<--:*/text())]

I tried

Aliases/Alias[@PartyType='DF' and not(./text() = preceding::/*text())]

thinking that the application might be using MSXML.net and not MSXML3 and it still gave me the same error.

???

1

There are 1 answers

11
FKDev On BEST ANSWER

Something like This maybe

/Aliases/Alias[not(./text() = preceding-sibling::*/text())]

(I haven't tried it but it should work)