[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: An XPath expression which checks that no two websi

Subject: Re: An XPath expression which checks that no two websites have the same username
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Mon, 5 Nov 2012 11:54:37 +0100
Re:  An XPath expression which checks that no two websi
Perhaps comparing the count of all @to values with the count of the
union of all @to values:

count(map/*/@to) eq count(union(map/*/@to))

which assumes, of course, that you don't have full identical duplicates.

-W


On 05/11/2012, Costello, Roger L. <costello@xxxxxxxxx> wrote:
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.