[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Comparing nodes in axis
I had that in mind from the begining, but for some strange reason i forgot to do it (maybe i'm getting old...). My case is very simple, so a simple <xal:variable name="thismenu" select="(//menu)[$pos])"/> and the use of the var instead of the expression will work ok. Thanks from remind me... Quoting David Carlisle <davidc@xxxxxxxxx>: > > 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 > ________________________________________________________________________ > > O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim! Clique em: http://antivirus.sapo.pt
|
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
|