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

Re: Testing by counting or positional predicate

Subject: Re: Testing by counting or positional predicate
From: "Daniel Bowen" <dbowen2@xxxxxxxxx>
Date: Thu, 11 Jan 2001 10:29:53 -0700
daniel bowen daniel bowen
Francis Norton wrote:

> David Carlisle wrote:
> >
> > >   count($node1|$node2) = 1
> > >
> > > or:
> > >
> > >   not(($node1|$node2)[2])
> >
> > or generate-id($node1)=generate-id($node1)
> >
> logically equivalent and certainly more readable, but on one stylesheet
> that I run (to de-dupe the output of an XML Spy conversion from XML
> Schema to XDR) the difference between Muenchian grouping with
> "count($node1|$node2) = 1" and one with "generate-id(node1) =
> generate-id(node2)" is 4.4 seconds v. 14.3 seconds!


Just for an opposing view point on this, on one stylesheet that I use
Muenchian grouping, I have a filter on the key "match".  When I use the
"count" method, I have to use the filter again when selecting the nodes, but
when I use the "generate-id" method, I don't have to use the filter again.
In my case, the "generate-id" method is 2-3 times faster!

Example:

  <xsl:key
    name="key-texture"
    match="Texture[0=count(preceding-sibling::Texture[1])]"
    use="concat(@texture, ':', @u, ':', @v)" />
  <xsl:variable
    name="primary-textures"
    select="//Texture[generate-id(.) = generate-id(key('key-texture',
concat(@texture, ':', @u, ':', @v))[1])]" />


is faster for me than:

  <xsl:key
    name="key-texture"
    match="Texture[0=count(preceding-sibling::Texture[1])]"
    use="concat(@texture, ':', @u, ':', @v)" />
  <xsl:variable
    name="primary-textures"

select="//Texture[0=count(preceding-sibling::Texture[1])][count(.|key('key-t
exture', concat(@texture, ':', @u, ':', @v))[1])]" />


-Daniel




 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.