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

Re: [solved] key with many uses's

Subject: Re: [solved] key with many uses's
From: Elizabeth Barham <soggytrousers@xxxxxxxxx>
Date: 06 Feb 2002 15:56:33 -0600
elizabeth 1 description
Hi Elizabeth,

Elizabeth Barham <soggytrousers@xxxxxxxxx> writes:
> I have a series of elements that I would like to group based on more
> than one parameter.
> 
> 1. <phone>713-228-XXXX</phone>
> 2. <phone type="fax">713-228-XXXX</phone>
> 3. <phone type="special" description="clients" paren="1" description-place="before">713-228-XXXX</phone>
> 4. <phone type="special" description="AIDS legal hotline:" paren="0" description-place="before">713-528-XXXX</phone>
> 5. <phone type="special" description="AIDS legal hotline:" paren="0" description-place="before" >800-528-XXXX</phone>
> 
> In this example, I'd like to somehow get both 4 and 5 together. I've
> considered using three keys:
> 	
> <xsl:key name="special-phone-d" match="phone[@type='special']" use="@description"/>
> <xsl:key name="special-phone-p" match="phone[@type='special']" use="@paren"/>
> <xsl:key name="special-phone-w" match="phone[@type='special']" use="@description-place"/>
> 
> and one key:
> 
> <xsl:key name="special-phone" match="phone[@type='special']" use ="@description | @paren | @description-place" />

You're better of using the second method as the first is goofy,
cumbersome and not very pretty to boot.

> Using the Muenchian Method it'd be something like this using the three
> keys:
> 
> <xsl:for-each select="$nodes[generate-id(.)] = generate-id(key('special-phone-d', @description)[1])]
> 	and
> 	$nodes[generate-id(.)] = generate-id(key('special-phone-p', @paren)[1])
> 	and
> 	$nodes[generate-id(.)] = generate-id(key('special-phone-w', @description-place)[1])">
> 

Try this:

<xsl:for-each select="$nodes[generate-id(.) = generate-id(key('special-phones', string(@description, @paren, @description-place))[1])]">

Why does this work as opposed to

<xsl:for-each select="$nodes[generate-id(.) = generate-id(key('special-phones', @description | @paren | @description-place)[1])]">

I hear you ask? Good question. Perhaps with a little more experience I
shall be able to answer this one myself.

Elizabeth

 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.