← Back to team overview

kolibri-discuss team mailing list archive

Re: Coordinate XmlGenerator and XslTransformer

 


On Dec 17, 2008, at 1:52 PM, Anders Steinlein wrote:

On Wed, 2008-12-17 at 11:25 +0100, Frode Danielsen wrote:
On Dec 17, 2008, at 11:03 AM, Anders Steinlein wrote:

[snip]

It's definitely unnecessary to jump between DOMDocument -> XML string
-> DOMDocument to use the output of XmlGenerator in XslTransformer.
Since they're both core utility classes I'd suggest XslTransformer
supports working directly with XmlGenerator (ie. using getDom())?

I don't think XslTransformer should have any dependency on XmlGenerator,
in order to allow it to be used with any plain DOMDocument from other
potential sources. Sending the result of getDom() to the transformer
instead of the generator instance itself seems good to me.

I wasn't really talking about a dependency. I only suggested that XslTransformer could support directly interfacing with a supplied XmlGenerator as well. But I guess it's not really necessary.

Another "weirdness" in XslTransformer as it stands now is that the
addXml() method really should be called setXml() considering how it
works right now. You can't incrementally add XML strings to
XslTransformer as it will just overwrite the previous XML. I guess
some improvement on this could be done as well, using the internal
DOMDocument more properly.

I don't really see the need to append/add several XML sources to the
transformer, but I agree that set is not the best of names. I suggest
loadXml() and loadDom().

I also don't see the need for adding XML from different sources to XslTransformer. It is and have always been just a simple abstraction over the XSLT interfaces in PHP. Previously we had to cope with two completely different interfaces in PHP 4 and 5, but now it's stripped down to pure PHP 5 support. These interfaces and XSLT engines usually only support one XML document through one XSL document, so it's natural that we don't complicate it by supporting multiple sources merged to one.

loadXml() and loadDom() sounds like reasonable method names, matching XmlGenerator's getXml() and getDom().

--
Frode



References