Re: [xslt] external data in stylesheets



Some good news and some bad news:

At 12:30 AM 7/23/01 +0100, Matt Sergeant wrote:
>On Sat, 21 Jul 2001, Elizabeth Mattijsen wrote:
>I *just* sent a patch to this list to fix the speed issues with
>document(''). Apply it and try again.

I thought it solved the issue of a DOM created from a string, not knowing 
it's own file name?

In any case, I've applied the patch and get the following benchmark results 
on two simple stylesheet ("call" being the one with the node-set in an 
explicit external (larger) xml-file, "own" being the one with a small 
internal node-set, "none" being the one without any transformations).

Without patch:
==============
Benchmark: timing 10000 iterations of call, own...
       call: 29 wallclock secs (25.97 usr +  2.98 sys = 28.95 CPU) @ 
345.42/s (n=10000)
        own: 16 wallclock secs (14.99 usr +  1.42 sys = 16.41 CPU) @ 
609.38/s (n=10000)
       none:  2 wallclock secs ( 2.14 usr +  0.01 sys =  2.15 CPU) @ 
4651.16/s (n=10000)

With patch:
===========
Benchmark: timing 10000 iterations of call, own...
       call: 29 wallclock secs (25.70 usr +  3.33 sys = 29.03 CPU) @ 
344.47/s (n=10000)
        own:  5 wallclock secs ( 5.02 usr +  0.03 sys =  5.05 CPU) @ 
1980.20/s (n=10000)
       none:  2 wallclock secs ( 2.05 usr +  0.00 sys =  2.05 CPU) @ 
4878.05/s (n=10000)

Deducting the time from "none" from both "own", gives a speed increase of 
almost a factor of 5 (14/3 to be a little more precise)!


However, I get the following error in a more complex stylesheet that uses 
xsl:for-each:

# xsltproc read.category.xsl /tmp/SearchNL/empty.xml
xsl:for-each : can't find doc
Segmentation fault

The only place where the error message appears, is in transform.c.

        /* For a 'select' nodeset, need to check if document has changed */
         if ( (list->nodeTab[i]->doc!=NULL) &&
              (list->nodeTab[i]->doc->doc!=NULL) &&
              (list->nodeTab[i]->doc->doc)!=ctxt->xpathCtxt->doc) {
             /* The nodeset is from another document, so must change */
             ctxt->xpathCtxt->doc=list->nodeTab[i]->doc->doc;
             if ((ctxt->document =
                   xsltFindDocument(ctxt,list->nodeTab[i]->doc->doc))==NULL) {
                 xsltGenericError(xsltGenericErrorContext,
                         "xsl:for-each : can't find doc\n");
                 goto error;
             }

It would seem that it determines that the nodeset is from another document, 
then attempts to read it, when it shouldn't.  I'm not versed enough in 
libxslt innards (yet) to see what needs to be changed here to not have it 
trigger on the document('') case.



Elizabeth Mattijsen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]