RE: Understanding xsl:key

Subject: RE: Understanding xsl:key
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Mon, 21 Aug 2000 12:22:48 +0100
>From Jeni's reply
When you define the key:

> <xsl:key name="test" match="title" use="name"/>

Then you are setting up a number of associations between 'title' nodes and
key values given to them through their 'name' child:

node		key value
title[1]	'Design Patterns'
title[2]	'Pattern Hatching'
title[3]	'Building Applications'

When you use:

  key('test', 'Pattern Hatching')

you are saying "What nodes within the 'test' key have the key value of
'Pattern Hatching'?"

So
<xsl:key name="test" match="title" use="substring-before(name, ' ')"/>
will create 
node		key value
title[1]	'Design'
title[2]	'Pattern'
title[3]	'Building'

I assume though I haven't tried it.

Ciao Chris

XML/XSL Portal 
http://www.bayes.co.uk/xml


>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Heiner de Wendt
>Sent: 21 August 2000 10:18
>To: xsl-list@xxxxxxxxxxxxxxxx
>Subject: Re: Understanding xsl:key
>
>
>Hello,
>
>Jeni and everyone else, big thanks for the help. I've understood the 
>beast now, I think ;-)
>
>I have one last problem with it, though. If I use, e.g.,
>
><xsl:apply-templates select="key('test','Pattern Hatching')"/>
>
>this selects all my appropriate nodes with "Pattern Hatching" as
>contents. But if I wanna select all nodes in which the word "Pattern" 
>appears, I don't know how to do it. I've tried 
>"key('test',contains(.,'Pattern'))" and some other things like that, 
>but I don't get it to work.
>
>Big thanks again,
>
>Heiner
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread