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

RE: RE: Muenchian technique, was (Keys on multiple el

Subject: RE: RE: Muenchian technique, was (Keys on multiple element types)
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 5 Feb 2002 13:55:18 -0000
norton produce kay
> Jeni said:
> > The keys don't; using the Muenchian method (which uses keys for
> > efficiency) does. The duplicates are removed by the statement:
> >
> >   *[generate-id(.) = generate-id(key('rows', name)[1])]
> >
> > where you select all the elements that are the same element as the
> > element you get when you use the 'rows' key with that element's name
> > (i.e. selects the first element with a particular name in the
> > document).
>
> Mike, your books states that the [1] is redundant for the Muenchian
> technique, yet it keeps getting repeated.

The [1] is indeed redundant, because generate-id(), if given a set of more
than one node, returns the id for the first one. But I think using the [1]
is good practice, as it documents clearly what you're doing.

Also, with XSLT 2.0 we might start to see processors that choose to do more
rigorous type-checking, and although omitting the [1] will still work, some
processors might give you a warning. In XPath 2.0 we say that supplying a
sequence where a singleton is expected is a type exception, from which an
XSLT processor should recover by taking the first item in the sequence: but
as with conditions like having conflicting template rules, we don't say the
processor can't produce a warning first.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx


 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.