xsl-list
[Top] [All Lists]

Re: [xsl] Using the key function

2007-05-23 06:31:56


<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[(_at_)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[(_at_)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. 
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>