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

Re: Efficiency, use param in key?

Subject: Re: Efficiency, use param in key?
From: Christopher_Dant@xxxxxxxxxxxxxx
Date: Sat, 3 Aug 2002 12:31:31 -0700
Re:  Efficiency
Marrow:

Wow - I really appreciate the depth of your comments!

> But no template match for the other, non-distinct, <file_audio> elements?
Is
> this by design or is that part of the stylesheet omitted?

By design. This is part of an "inventory check" used to ensure that all
needed files are present before publishing a course.

> Therefore, it might improve efficiency if you move the distinct filtering
to the
> <xsl:apply-templates>, e.g.
> <xsl:apply-templates select="//file_audio[generate-id() = generate-id(key
('fn',@fileref)[1])]">
>   <xsl:sort select="@fileref"/>
> </xsl:apply-templates>

Interesting. I tried it both ways on a sample file and found about 10%
performance difference in favor of putting the distinct filtering in the
template match="" over the apply-templates select="". (Instant Saxon 6.4.1)
Not much of a difference, particularly compared to timings of versions with
and without the use of a key.

> If efficiency is of primary concern then it is likely that a separate
stylesheet
> for each type will yield better performance than trying to parameterize
the same
> stylesheet to handle all.

For the purposes of my own education, efficiency is the primary concern.
But for long term maintenance, parameterization is more important.

> But that is not to say your stylesheet cannot be parameterized to cope
with the
> task.  When using keys this can often be achieved by taking the part of
the
> <xsl:key>'s @match that is to be parameterized and moving it into the
@use
> clause as a static value (the static value can then be passed in when the
key()
> function is used), e.g.

Excellent - I see that now. I had not considered extending a single key for
multiple purposes, even though now I remember seeing that done in other
cases. Your example of it makes great sense, particularly since I've
realized that I might as well do all of the different types of files in a
single run.

Thanks again!
Chris



 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.