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

Re: More Efficient way of mathching ID's

Subject: Re: More Efficient way of mathching ID's
From: "Alexander Johannesen" <alexander.johannesen@xxxxxxxxx>
Date: Tue, 4 Apr 2006 06:43:47 +1000
mathching by names
Hi,

On 4/4/06, Spencer Tickner <spencertickner@xxxxxxxxx> wrote:
> *** Without.xml ***
> <?xml version="1.0"?>
> <document>
>         <article qpid="004243">
>                 <title>Test test Test Test Test</title>
>                 <sentence qpid="007309">
>                         <text>
>                                 Test test Test Test Test</text>
>                 </sentence>
>         </article>
...

In your XSLT you've got a *very* expensive lookup
"$fIntents//sentence" which you create every time you hit that
template. You could move this part of your selection into the global
scope, which probably also would speed up the existing code quite a
bit (depending on processor).

   <xsl:variable name="qpid" select="$fIntents//sentence[@qpid]" />

and use this locally ;

   <xsl:apply-templates select="$qpid[@qpid = $mykey]/intentref"/>

> As a note, reference.xml is much much bigger than this small test and
> will have all the qpid's I need to deal with the qpid's in without.xml
> file,, as well as a bunch more that will not be needed. I hope this
> illustrates what I' trying to do.

Sure. One question, though; is the schema for the without.xml file
set? Very often you'll find that if you've got id's and references
you'd get free boost through xsd:ID, so if you've got ;

   <article id="004243"> ... <sentence id="34563"> ...

you can use the XSLT function id() to quickly locate these, through
"<xsl:value-of select="id(@qpid)" />". This is also the only way to
create a key-set with multiple matches (if my memory servers), but
that might be minor. [http://www.dpawson.co.uk/xsl/sect2/N4598.html]

Also, your other speedy option is to use keys
[http://www.dpawson.co.uk/xsl/sect2/N4852.html] ; define a key in the
global scope and use it for your lookups;

   <xsl:key name="lut" match="@qpid" use="." />

Once you use this key on a set of data, a table is set up which will
be used for any next lookup as well, and some procesors might even
preempt their use and optomize further.


Alex
--
"Ultimately, all things are known because you want to believe you know."
                                                         - Frank Herbert
__ http://shelter.nu/ __________________________________________________

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.