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

Re: How do you select all unique first-position charac

Subject: Re: How do you select all unique first-position characters?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 21 Nov 2002 15:38:36 GMT
charac generate

  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


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.