[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: sequence with same id values
On 3/6/06, Jeff Sese <jsese@xxxxxxxxxxxx> wrote: > Hi all, > > I have this variable: > > <xsl:variable name="anchor" as="element()*" > select="document('source.xml')//anchor[parent::xref]/@id"/> > > How can I get all the id values that are not unique? Create a key: <xsl:key name="anchor-by-id" match="anchor[parent::xref]" use="@id"/> Then for each anchor, count how many occurances are in the key: select="count(key('anchor-by-id', @id) > 1)" If there is more than one occurrance then the id is not unique. If you don't want an entry for each non-unique @id, then only generate output for the first occurrance: select="count(key('anchor-by-id', @id) > 1) && generate-id(.) = generate-id(key('anchor-by-id', @id)[1])" cheers andrew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|