xsl-list
[Top] [All Lists]

RE: Max size?

2003-01-10 02:33:09
Michael Kay wrote:
That's precisely what I meant by "a small class of very simple 
stylesheets". I came to the conclusion that there are so few real 
stylesheets like this that it's not worth the trouble.

I thought this situation was quite common, but at a second 
thought you are probably right. I still think, however, that 
many of the current style sheet would allow discarding quite 
a few of the input early, or could be rewritten to allow 
this. How could this problem be attacked? Would schema 
information help? I think effective processing of large 
documents is a concern.


One approach is to use a completely different language for serial
transformations. There is a group developing something called STX to
achieve this. To do serial transformations, I believe you need a
different processing model. Because you can't revisit a node once it's
passed by, I believe that you need to maintain state (some kind of
working storage), and you therefore need a procedural language rather
than a declarative one. Alternatively you could provide update (rather
than merely append) access to the result tree, so that it's the result
tree rather than the source tree that has to be kept in memory.

Another possible approach (built on the concept of Saxon's preview mode)
is to map the large source document to a set of small source documents,
one per "record" (typically a level-2 element). If these small documents
are supplied as the value of the input() collection (an XSLT 2.0
facility), and if the entry template in the stylesheet takes the form

<xsl:apply-templates select="input()"/>

and if there are no other references to input(), then you know that the
"documents" in the input collection can be processed one at a time, and
that each one can be discarded as soon as it has been processed.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>