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

RE: XSL:Copy w/ Processing Optimization Suggestions

Subject: RE: XSL:Copy w/ Processing Optimization Suggestions
From: "Conal Tuohy" <conalt@xxxxxxxxxxxxxxx>
Date: Thu, 13 Mar 2003 15:20:23 +1300
xsl sort optimizing
I think the logic of your xsl:if is strange. Your template matches a lot of
things, and then sorts and copies them unless they are <part> elements with
a @DisplayValue='BM5125'? It looks to me as if your code would sort the
Body, Global, and Nav elements as well. Perhaps I'm seeing things :-)

>From your desired output it seems you are only interested in changing the
contents of the Results element. If so, you should define a template to
handle just this, and use an identity transform to handle the rest.

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="Results">
  <xsl:copy>
    <xsl:apply-templates
select="Part[not(starts-with(@DisplayValue,'BM5125'))]">
      <xsl:sort order="ascending" select="@DisplayValue"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

Also NB I used the starts-with() function instead of contains(), since this
is bound to be slightly faster. :-)

Cheers!

Con


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.