Subject: Re: XSLT 2.0 Idea: third argument for key() From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 04 Sep 2000 18:26:25 -0400 |
In brief: I'd like to suggest having a third argument for key(), a node set, such that the key only retrieves nodes with the relevant key value that are within this node set.
Here's an example of the second area in which this would be useful, restricting nodes to a known node set: say I had a document with a massive dataset like:
<athletes> <country id="GRB"> <athlete event="100 metres">...</athlete> <athlete event="200 metres">...</athlete> <!-- another 400 athletes --> </country> <country id="ROI"> <athlete event="100 metres">...</athlete> <athlete event="800 metres">...</athlete> <!-- another 400 athletes --> </country> ... </athletes>
I want to put the details of the athletes in a table, with columns being countries and rows being events, so I use a key to index on the event, and access the data for the table using:
key('athletes', @event)[generate-id(parent::country) = generate-id(current()/parent::country)]
or something similar. It would be a lot cleaner to do:
key('athletes', @event, parent::country/child::athlete)
... <!ENTITY lookup-athletes "concat( generate-id(parent::country), ' ', @event )> ... <xsl:key name="athletes" match="athlete" use="&lookup-athletes;"/> ... key('athletes', &lookup-athletes;) ...
Any thoughts? Objections? Implementation issues?
-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. Book: Practical Transformation Using XSLT and XPath ISBN1-894049-05-5 Article: What is XSLT? http://www.xml.com/pub/2000/08/holman Next public instructor-led training: 2000-09-19/20,2000-10-03/05, - 2000-10-09/10,2000-10-19,2000-11-06/07,2000-11-12, - 2000-12-03/04,2001-01-27
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
XSLT 2.0 Idea: third argument for k, Jeni Tennison | Thread | RE: XSLT 2.0 Idea: third argument f, Kay Michael |
RE: XML/XSL parser for Perl, Tomas Aspelin (SIX) | Date | Re: Built-in template rule for attr, John E. Simpson |
Month |