[xsl] Using the key function

Subject: [xsl] Using the key function
From: "Fanghanel, Karl" <Karl.Fanghanel@xxxxxxxxx>
Date: Tue, 22 May 2007 16:18:53 -0400
Hello All,

I'm working on a problem which I thought could be solved by using the
key function however it's not working as I thought.

I'm using the group-by function to gather most of my required
information except for a length attribute which is under a different
element.  I figured I could use the key function to acquire this other
value, but it doesn't work.

I'm thinking that either my select statement is wrong or maybe my key
isn't right.  Could someone please provided some insight of what I may
be doing wrong?

Below is a snippet of my xsl and xml data I'm using.  I'm using saxon8.

Thank you,

--- XSL ---
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >

<xsl:output method="html"/>

<xsl:key name="numkey" match="//house" use="member/@ref"/>

<xsl:for-each-group select="//*"
<xsl:sort select="@number"/>
			<xsl:value-of select="current-grouping-key()"/>

--- XML Data ---
<?xml version="1.0" encoding="UTF-8" ?>
	<trail> id="1234" length="50.5" </trail>
	<trail> id="9876" length="40.0" </trail>
		<member> ref="1234" </member>
		<property> name="number" val="123L0001" </property>
		<member> ref="9876" </member>
		<property> name="number" val="123L0002" </property>

Current Thread