[expect php] [file] <?php require 'Phalanger.inc'; echo "Test 5: Checking Indent"; include "prepare.inc"; $xp = new domxpath($xsl); $res = $xp->query("/xsl:stylesheet/xsl:output/@indent"); if ($res->length != 1) { print "No or more than one xsl:output/@indent found"; exit; } $res->item(0)->value = "yes"; $proc->importStylesheet($xsl); print "\n"; print __xml_norm($proc->transformToXml($dom)); print "\n";
[expect php] [file] <?php require 'Phalanger.inc'; echo "Test 6: Transform To Doc"; include "prepare.inc"; $proc->importStylesheet($xsl); print "\n"; $doc = $proc->transformToDoc($dom); print __xml_norm($doc->saveXML()); print "\n";
[expect php] [file] <?php require 'Phalanger.inc'; class books extends domDocument { function addBook($title, $author) { $titleElement = $this->createElement("title"); $titleElement->appendChild($this->createTextNode($title)); $authorElement = $this->createElement("author"); $authorElement->appendChild($this->createTextNode($author)); $bookElement = $this->createElement("book"); $bookElement->appendChild($titleElement); $bookElement->appendChild($authorElement); $this->documentElement->appendChild($bookElement); } } $dom = new books(); $dom->formatOutput = true; $dom->load(dirname(__FILE__) . "/book.xml"); $dom->addBook("PHP de Luxe", "Richard Samar, Christian Stocker"); echo __xml_norm($dom->saveXML());
[expect php] [file] <?php require 'Phalanger.inc'; echo "Test 7: Transform To Uri"; include "prepare.inc"; $proc->importStylesheet($xsl); print "\n"; $doc = $proc->transformToUri($dom, "file://" . dirname(__FILE__) . "/out.xml"); print __xml_norm(file_get_contents(dirname(__FILE__) . "/out.xml")); unlink(dirname(__FILE__) . "/out.xml"); print "\n";