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

Re: Using the key function

Subject: Re: Using the key function
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 23 May 2007 14:31:37 +0100
Re:  Using the key function
<xsl:key name="numkey" match="//house" use="member/@ref"/>
OK, although as I say, // never means anything at the start of a match.

	

	<xsl:for-each-group select="//project"
OK but do you really want to select projects or houses?


        group-by="property[@name='number']/@val"

the group-by expression will be evaluated from the selected project node
which doesn't have a property child, so this will always evaluate to
empty so everything is in one group.

You haven't given any indication of what output you want so I don't know
if you want to group houses (by changing the select to //property/house)
in which case this group-by expression would do something more
interesting, or if you want to group projects which would be something like
 group-by="house/property[@name='number']/@val"
except that that will return multiple values for each project, which you
probably don't want.


		<xsl:sort select="@number"/>
This will do nothing on the posted example as project elements don't
have number attributes, but perhaps your real input does.

select="key('numkey',@id)
@id selects the id attribute of the current node (which is a project
node) which doesn't have any attributes in your posted input


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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-2011 All Rights Reserved.