[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: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Thu, 21 Nov 2002 09:50:44 -0500
RE:  How do you select all unique first-position charac
Wendell,

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?  I know it's not, because it works.

Thanks,
Jeff

-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Wednesday, November 20, 2002 6:22 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  How do you select all unique first-position
characters?


I should think a key using the initial letter of each name would be a big
help:

<xsl:key name="person-by-initial" match="person"
use="substring(@name,1,1)"/>

Then "key('person-by-initial', 'A')" would get you back the elements for 
Anthony, Amy and the other Amy, and "key('person-by-initial', 'A')[1]" 
would get you just Anthony.

//person[count(.|key('person-by-initial', @name)[1]) = 1] gets you all 
person elements that are first with their initial.

In other words, the usual grouping stuff.

Cheers,
Wendell

(At 04:50 PM 11/20/2002, Greg wrote:
>At 01:36 PM 11/20/2002, you wrote:
>><report-data>
>>         <person name="Anthony" />
>>         <person name="Amy" />
>>         <person name="Amy" />
>>         <person name="Jim" />
>>         <person name="Jason" />
>></report-data>
>>
>>I would expect to get A,J from the above XML
>
>   Here's most of it for you.  I'm having trouble with the initial 
> variable selection though.  I'm hoping somebody can take it from here, as 
> I'm stumped now too....


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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

 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.