Subject: Re: [xsl] Using the key function From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 23 May 2007 14:31:37 +0100 |
<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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Using the key function, Fanghanel, Karl | Thread | Re: [xsl] Using the key function, Abel Braaksma |
Re: [xsl] order as defined in the s, David Carlisle | Date | Re: [xsl] order as defined in the s, David Carlisle |
Month |