Re: selection with multiple keys

Subject: Re: selection with multiple keys
From: David_Marston@xxxxxxxxx
Date: Thu, 20 Jan 2000 14:21:42 -0500
Dr. Tim Dudgeon (dudgeon@xxxxxxxxxxxxx) writes:
>I've found keys, defined with xsl:key and selected with the key() function
>real useful. However I'm having problems selecting using multiple keys.

>...Finally I tried using a node set as the second argument to key(), as
>XSLT standards says
>'When the second argument to the key function is of type node-set, then
>result is the union of the result of applying the key function to the
>value of each of the nodes in the argument node-set.'
>However this sort of expression also returns nothing:
><xsl:apply-templates select="key('PrID', /document/ruleset/rule/@id)"/>

We have a test here at Lotus (known as IDKY17 in our test suite) that tests
this exact provision of the spec. The test currently passes on 0.19.2. The
only difference from what you report above is that the test uses for-each
instead of apply-templates. As a warm-up, you could try
<xsl:value-of select="count(key('PrID',path))"/>
to ensure that you get as many nodes as you expect.

Naturally, I'm assuming that you can't change the source document to add
a new attribute specifically to be used in a keyspace.

David Marston

 XSL-List info and archive:

Current Thread