[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] An XPath expression which checks that no two websites have the same username


Subject: [xsl] An XPath expression which checks that no two websites have the same username
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Mon, 5 Nov 2012 10:44:53 +0000

Hi Folks,

I need a good XPath expression which checks that no two websites have the same
username.

Here is a map between websites and usernames:

    <map>
        <singletonMap from="Amazon"           	to="BasketballKing" />
        <singletonMap from="Apple"            	to="RandomGamer" />
        <singletonMap from="Ebay"             	to="CornFoo" />
        <singletonMap from="Google"           	to="LatenightRevolution" />
        <singletonMap from="Microsoft"        	to="OldTrue" />
        <singletonMap from="VirginAtlantic"   	to="TheSinger" />
    </map>

In that example no two websites have the same username.

I created an XPath expression which does the job, but I suspect there is a
simpler expression. Here is my attempt:

empty(for $i in map/*/@to return map/*[@to eq $i][2])

Would you provide a simpler (more efficient, more elegant) version please?

/Roger


Current Thread
Keywords