xsl-list
[Top] [All Lists]

Re: Testing if an attribute name is in a list of names

2005-05-19 07:26:11
On Thursday 19 May 2005 14:08, Paul A. Hoadley wrote:

I suppose you could use keys for faster access, but I don't know how
that would affect total transform time.

You're right, I guess the question is "does this affect the transform
time?"  Even the nested for-each constructs don't seem to, probably
because the input is only of the order of hundreds or a few thousand
rows in my case.  I was just wondering whether there is an idiom in
XSL that is analogous to my pseudocode above.  I can't seem to hit on
it myself.

Using key() is the easy way to get O(n). You can also solve this via 
contains() against a string built up from the attribute names with delimiters 
but that is less flexible although possibly quicker for some datasets, i.e. 
not many attribute names to match against or few tests to perform.

Creating a key will cost something but my experience is that for small 
datasets you probably won't care and for large ones the cost is very often 
small in comparison to the gains you can get.

Regards,
Kev.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--