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

Re: Comparing nodes in axis

Subject: Re: Comparing nodes in axis
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 21 Dec 2004 09:53:59 GMT
comparing nodes xslt
Note in all these you have multiple occurrences of (//menu)[$pos]) this
is (on the face of it) a massively expensive operation: search the
entire document to an arbitrary depth, looking for menu nodes, and then
select the $pos'th menu.

It may be that your processor spots that the same expression is being
used multiple times and optimises away some of the cost but it's still
going to take at least one very slow search. You could at least help it
by saving <xal:variable name="thismenu" select="(//menu)[$pos])"/>
and using $thismenu instead, and possibly (depending on the details of
your stylesheet) you should get rid of the $pos parameter altogether and
just use the $thismenu parameter. Often when people coming to xslt ffrom
other languages pass around an integer parameter and repeatedly re-index
into some node list, they are just used to the less natural data
structures in those languages, in xslt if a template depends on anode,
you can pass that node in as a parameter, you don't have to pass in an
integer and make it select the node.

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.