Subject: Re: [xsl] Comparing nodes in axis From: António Mota <xptm@xxxxxxx> Date: Tue, 21 Dec 2004 16:39:48 +0000 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Comparing nodes in axis, David Carlisle | Thread | RE: [xsl] Comparing nodes in axis, Michael Kay |
RE: [xsl] non MS transform, Pieter Reint Siegers | Date | Re: [xsl] non MS transform, Wendell Piez |
Month |