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

RE: cross document id idref pair checks

Subject: RE: cross document id idref pair checks
From: DPawson@xxxxxxxxxxx
Date: Wed, 10 Jan 2001 09:10:38 -0000
RE:  cross document id idref pair checks
Jeni Tennison 
> I think (?) that DaveP meant duplicated values for @id attributes
> across a document rather than duplicate @id attributes on a particular
> element.
> 
> If there is an element that has the same @id attribute as the current
> element, then:
> 
> You can get elements that have repeated ids with:
> 
>   //*[@id = (preceding::*/@id | following::*/@id)]

but noted comment on efficiency.

> If, for an element, the 'ids' key returns more than one node, then
> it's a repeated id, so you can test whether there are any repeats
> with:
> 
>   //*[key('ids', @id)[2]]

I like the look of that.



> If you want to get a list (without repeats) of the repeated IDs using
> the key() method, then you can use the usual:
> 
>   //*[key('ids', @id)[2] and
>       count(.|key('ids', @id)[1]) = 1]

I'd dispute the use of the word 'usual' here Jeni :-)



> 
> [or actually, by extension to the above aside:
> 
>   //*[key('ids', @id)[2] and
>       not((.|key('ids', @id)[1])[2])]
> 
>  making identity-testing of nodes even more obscure! :)]

I won't disagree with the latter comment!!


> 
> Testing this across documents is harder 

But not required, the test is that no two elements share the same id value
in the document under test (which is the source document)

Thanks Jeni. 

I'll run some timing on those and compare with DC's 'count() method.

Regards DaveP

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.