xsl-list
[Top] [All Lists]

Re: How do you select all unique first-position characters?

2002-11-21 08:38:36


  Could you explain to me why the union of the current node with that of the
  first node returned from the xsl:key is needed in the count?

  Wouldn't that always be 1? 

This is the "standard trick" for determining if two nodes are the same
node (as opposed to having the same value)

If you want to know if . and key(,,,)[1]  are the same thing then you can
form
. | key(,,,)[1]

this is a node set consisting of 1 node if they are the same and two if
they are different (actually it would also have size 1 if key() did not
return anything, but from the context  you know that there will be
something with that key in this case)

you can do

generate-id(.) = generate-id(key(,,,)[1])

which does the same test.

In Xpath 2 (if you can cope with the schema-horrors) then you can just
test for node equality directly with
 . is key(,,,)[1]

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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