Re: [PHP-XML-DEV] Pipelined XSL
[email protected] ("Alexandru COSTIN")
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
Hello Christian.
Nice hearing back from you.
> > pretty dead).
>
> I'm not sure, what exactly you mean with "pipelined XSL
> transformations". I assume, it's not:
>
> DomDocument -Transformation-> DomDocument -XSLT-Transformation-> (
> ...etc..) -> EndResult
No, indeed, we already do this in Krysalis and you probably do it too in
Popoon.
> or is it more sth like:
>
> http://xml.apache.org/xalan-j/usagepatterns.html#outasin
This is more like it.
> > We are running in some memory problems with huge XML trees and I
wonder
> > if they could be corrected using some kind of input/output streams.
>
> libxslt needs the whole document in the memory before processing. I'm
> not sure, if there are XSLT-Processors out there, which can handle that
> differently. Even Xalan has to read the whole Document (but not
> necesseraly the whole thing at once into the memory, see
> http://xml.apache.org/xalan-j/design/design2_0_0.html#stree dor some
> detilas)
This stree would be great to be implemented. Let me explain what we
really need to make things clearer.
We have an XML containing
<root>
<row>
<name>Christian</name>
</row>
<row>
<name>John</name>
</row>
</root>
The XSL that transforms it contains basically a xsl:for-each on
/root/row, and for each name creates a new node
<pdf:text width=100><xsl:value-of select="name"/></pdf:text>
The new generated tree is then serialized by us to a PDF file directly.
The problem is that we have some 500 pages reports that take 500 MB in
the memory before generation. And I was thinking that we could do something
like "incremental transformation" that transforms a part of the XML tree,
then serves it to the Serializer, then frees the memory and continues with
the transformation. (with a breaker per /root/row in our case). I know that
PHP isn't designed for multithreading (which would be necessary in some
"emulated" form at least), but this is an approach that would allow SAX like
performance (in terms of memory) for DOM/XSL transformations.
> > Is there any method of compressing the size of XML trees in memory
> > (there is a compression attribute which is always -1 as far as I
recall).
>
> Attributes in the current DomXML are sth not worth looking at and not
> really used internally (some leftovers from early developement).
I see.
> But I
> think, the compression attribute was intented to use for compressing the
> serialized XML Document. Compressing the tree in memory? Mmmh, would
> definitively slow down performance and is IMHO not very practical.
Ok, I am just wondering.
As we've reached this huge memory requirement, we were wondering if
there is anything else that could help us (the idea in that our current
client has 2 GB, we can serve his transformations). But we might not be that
fortunate for other clients.
Otherwise, Lucian has developed a XSD validator in PHP, it will take an
XML schema and create a PHP file that validates XML documents to match the
schema. (we use DOMXML of course for most of the tasks :). It will be
included in the next version of Krysalis.
We have also integrated mozilla in KrysalIDE, and now we have a very,
very powerful tool for XML/XSL development. Maybe you want to take a look,
we'll be glad to send you the current beta.
I was also wondering about the DOMXML support in PHP on windows - are
you aware of any leaks? When doing those huge transformations we end up with
80 MB "leftovers" in the Apache process (which fortunately go away when the
process restarts (apache 1.3.27).
Keep in touch
Alexandru
>
>
> chregu
--
Alexandru COSTIN
Chief Operating Officer
http://www.interakt.ro/
+4021 411 2610