xsl-list
[Top] [All Lists]

[xsl] xslt performance issue position() function used in predicate very slow

2006-08-25 04:20:36
Hi,

I'm processing xml files that have 150kB size
they are composed from xml blocks that contain 350 elements with int values
here is example

< obj name="obj1">
 <v>1</v>
 <v>2</v>
 <v>3</v>
 ....
 <v>350</v>
</obj>

obj blocks are  repeated many times 
in general my xslt selects some  set of <v> rows and saves in csv format
e.g. select  1,2,3,4,15,28,71,17,19 and save to csv
in my xslt I'm using below expression to select v rows

<xsl:value-of select="./v[position()=$p]"/>

( in for-each loop I assign value to $p variable)

on P4 2.8 Ghz 512MB ram it takes 20 seconds! to parse 150KB file !!!
if I comment out  this line it takes 1 second so definitely it's issue with
position()
and selecting this v values.

BTW abbreviated version doesn't wok  i.e. select="./v[$p]" but
select="./v[$p+0]" works
is this some bug ???

Thanks for any tips how to improve performance 

Chris




--~------------------------------------------------------------------
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>
--~--