Re: RE: Muenchian technique, was (Keys on multiple el
Hi Dave, >> So in general if you're trying to assess whether two nodes are the >> same, it's important to pull out the two nodes individually. The >> only reason that you can get away with *not* using the  if >> you're using the generate-id() method of comparing nodes is because >> generate-id() automatically looks at only the first node in the >> node set. > > Am I right in thinking that 'the first node in the node-set' in the > para above, means the first node for which the predicate is true? No, I meant the first node in the node set passed as the argument to the generate-id() function. In other words: generate-id($node-set) is exactly the same as: generate-id($node-set) When you the node set you pass to generate-id() contains more than one node, it returns a generated ID for the first node (in document order) in the node set. > I had this last week with > > $variable[generate-id(.) = generate-id(key('rows', name))] > > so here the ndl in $variable is 'searched' for the first node for > which the predicate is true? Then returned as the value of the > expression? Obviously it depends on the data, but the above expression should return more than one node in some circumstances - all those nodes in the $variable node set that are the first node (in document order) returned by calling the key with their name element child as the key value. So $variable is searched for *all* nodes for which the predicate [generate-id(.) = generate-id(key('rows', name))] is true. If you only got one node back from the above expression as a whole then perhaps all the nodes in the $variable node set have the same name, or those that have a different name weren't indexed by the 'rows' key, or you were using it in a context where the result of the above expression got converted to a node set containing only one node (e.g. in xsl:value-of, as an argument to string() or number(), or of course generate-id() ;). Hope that makes sense (bit worried we're starting to talk at cross purposes). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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