[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: simple question regarding xsl:key and value calcul

Subject: RE: simple question regarding xsl:key and value calculation
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 25 Aug 2003 15:49:46 +0100
calcul xsl
Consider

<book id="1">
  <author>John</author>
  <author>Jane</author>
  <author>Mary</author>
</book>
<book id="2">
  <author>John</author>
</book>
<book id="3">
  <author>John</author>
  <author>Jane</author>
</book>

<xsl:key name="k" match="book" use="author"/>

For book id=1, the value of the use attribute is a node-set containing
three author elements. Each element contributes one value to the key.
The value that it contributes is the string-value of the author element.
So the three key values for book id=1 are "John", "Jane", and "Mary".

So the value of key('k', 'Jane') is the set containing book id=1 and
book id=3.

Is that clearer?

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Robert P. J. Day
> Sent: 25 August 2003 11:47
> To: XSL List
> Subject:  simple question regarding xsl:key and value calculation
> 
> 
> 
>   when calculating the value of a key, kay (p. 243) states:
> 
>   "For each node that matches the pattern, the expression is evaluated
>   with that node as the current node ... and then:
> 
>    * If the result is a node-set, each node in the result contributes
>      one value for the key.  The value of the key is the string-value
>      for that node."
> 
> i'm just having trouble parsing this last sentence.  given a 
> node-set as a result, how exactly do the nodes in that 
> node-set determine the eventual key?  or is it keys?  since 
> that sentence seems a bit ambiguous.
> 
> rday
> 
> 
>  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.