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

Re: Optimizing XSLT iteration

Subject: Re: Optimizing XSLT iteration
From: "Sujata Gohad" <sgohad@xxxxxxx>
Date: Sun, 7 Oct 2007 15:15:05 -0700
Re:  Optimizing XSLT iteration
Hi Deborah,

Thanks for your response. I had tried the approach your suggested as
well, but no improvement in performance. :(

I am using Saxon8, that seems to be smartly execute the position()=1
iteration only once. (I verified this using Stylus Studio debugger).


Are there any other suggestions? Any possibility of introducing
parallelism, etc? :-)


Many thanks,
- Sujata

On 10/7/07, Deborah Pickett <debbiep-list-xsl@xxxxxxxxxx> wrote:
> Sujata Gohad wrote:
> >                             <xsl:for-each select="locus[position()=1]">
> >                                 <xsl:text >M </xsl:text >
> >                                 <xsl:value-of select="@ellipse_x"/ >
> >                                 <xsl:text > </xsl:text >
> >                                 <xsl:value-of select="@ellipse_y"/ >
> >                             </xsl:for-each >
> >                             <xsl:for-each select="locus[position()!=1]">
> >                                 <xsl:text > L</xsl:text >
> >                                 <xsl:value-of select="@ellipse_x"/ >
> >                                 <xsl:text > </xsl:text >
> >                                 <xsl:value-of select="@ellipse_y"/ >
> >                             </xsl:for-each >
>
> > Is there a way to faster iteration of the "locus" elements?
>
> See if this is any quicker:
>
> <xsl:for-each select="locus">
>   <xsl:choose>
>     <xsl:when test="position() = 1">
>       <xsl:text>M </xsl:text>
>     </xsl:when>
>     <xsl:otherwise>
>       <xsl:text> L </xsl:text>
>     </xsl:otherwise>
>   </xsl:choose>
>   <xsl:value-of select="@ellipse_x"/ >
>   <xsl:text > </xsl:text >
>   <xsl:value-of select="@ellipse_y"/ >
> </xsl:for-each>
>
> Depending on your XSLT processor, your original code may be constructing
> up to four node-sets: locus, the subset when position() = 1, locus
> (again), the subset when position() != 1.
>
> You're allowed to use position() in almost any expression, not just as
> the predicate of a prior selection.  In my code, position() applies to
> the position that each locus has in the most recent for-each, which is
> what you want.

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.