Subject: Re: [xsl] Efficiency, use param in key? From: Christopher_Dant@xxxxxxxxxxxxxx Date: Sat, 3 Aug 2002 12:31:31 -0700 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Efficiency, use param in , Marrow | Thread | Re: [xsl] Efficiency, use param in , Christopher_Dant |
Re: [xsl] Efficiency, use param in , Robert S. Koberg | Date | Re: [xsl] Re: Efficiency, use param, Christopher_Dant |
Month |