<?php

require 'tutorial_autoload.php';
$docbook = new ezcDocumentDocbook();
$docbook->loadFile('docbook.xml');
$converter = new ezcDocumentDocbookToOdtConverter();
$converter->options->styler->addStylesheetFile('custom.css');
$odt = $converter->convert($docbook);
echo $odt->save();
Пример #2
0
 /**
  * Create document from docbook document
  *
  * A document of the docbook format is provided and the internal document
  * structure should be created out of this.
  *
  * This method is required for all formats to have one central format, so
  * that each format can be compiled into each other format using docbook as
  * an intermediate format.
  *
  * You may of course just call an existing converter for this conversion.
  *
  * @param ezcDocumentDocbook $document
  * @return void
  */
 public function createFromDocbook(ezcDocumentDocbook $document)
 {
     if ($this->options->validate && $document->validateString($document) !== true) {
         $this->triggerError(E_WARNING, "You try to convert an invalid docbook document. This may lead to invalid output.");
     }
     $this->path = $document->getPath();
     $converter = new ezcDocumentDocbookToOdtConverter();
     $converter->options->errorReporting = $this->options->errorReporting;
     $doc = $converter->convert($document);
     $this->document = $doc->getDomDocument();
 }
 /**
  * @dataProvider getTestDocuments
  */
 public function testStylerCalls()
 {
     $testDocs = self::getTestDocuments();
     if (count($testDocs) < 1) {
         throw new RuntimeException('Missing test documents.');
     }
     $doc = new ezcDocumentDocbook();
     $doc->loadFile($testDocs[0][0]);
     $stylerMock = new ezcDocumentOdtTestStyler();
     $converter = new ezcDocumentDocbookToOdtConverter(new ezcDocumentDocbookToOdtConverterOptions(array('styler' => $stylerMock)));
     $created = $converter->convert($doc);
     $this->assertTrue($stylerMock->odtDocument instanceof DOMDocument);
     $this->assertEquals(38, count($stylerMock->seenElements));
 }