[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xxRe: efficient use of key element and function
> I was thinking the use attribute only comes into play _after_ a match > was found and in some way can be viewed as a return value (per node) no you have that backwards, the use attribute specifies the allowe _arguments_ to the key function, the match attribute specifies teh returned value. key('x',...) (in xslt1) is a function from strings to node sets key('x','"foo") returns a set of nodes with key "foo". The way this is function is defined is that the set of nodes returned is the set of nodes that match the match attribute, and have a use attribute that evaluates to "foo". > > If might be better to match on text() than on * >For my test-case it should be the same. They will only be the same if your input document only has one element (and no comments). If you have <xsl:key match="*" use="."/> Then the key for the top level element will be all the character data in the document, concatenated. The system will then have to ake a hash table entry using that large string as label. key('x',string(/*)) would then return this element, but you would be a lot more efficient just to use /* without using keys at all. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|