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

Re: Key/Use

Subject: Re: Key/Use
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 5 Sep 2001 15:11:54 +0100
key use
    Excuse my ignorance but, why is this

   <xsl:key name="lookup" match="row"
   use="concat($TRANSFORMER_SourceCountry,'_layer_name')"/>

   any more useless than?:
  
   <xsl:key name="lookup" match="row" use="US_layer_name"/>
  


The first one uses a constant key value. If it were legal syntax (which
it would be if the explicit comment disallowing variables had not been
added to the spec) and if
$TRANSFORMER_SourceCountry were 'US' then
 
 <xsl:key name="lookup" match="row"
 use="concat($TRANSFORMER_SourceCountry,'_layer_name')"/>

would be


 <xsl:key name="lookup" match="row"
 use="'US_layer_name'"/>

ie every row gets the same key value 'US_layer_name' Thus you couldn't
use this key to get any subset of the row elements, just all of them at
once, in which case there's no need for a key at all you could just use
<xsl:variable name="x" select="//row"/>

The second one uses a non-constant Xpath.

each row gets the value of the US_layer_name element which is the child
of that row, so different rows potentially get different keys, and you
can use xsl:key to quickly find the rows with any particular key value.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 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.