[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: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 5 Feb 2002 14:35:09 +0000
tennison technique
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 [1] 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[1])

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)[1])]
>
> 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)[1])] 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


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.