[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

Subject: Re: xxRe: efficient use of key element and function
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 7 Sep 2005 12:07:18 +0100
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
________________________________________________________________________

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.