public function transform($xslDocument)
    {
        if ($xslDocument->domDocument) {
            $processor = new \XsltProcessor();
            $processor->importStylesheet($xslDocument->domDocument);
            $htmlDomDocument = new self;
            $htmlDomDocument->domDocument = $processor->transformToDoc($this->domDocument);

            if (!$htmlDomDocument->domDocument) {
                throw new Dom\Exception('The XSL transformation has failed.');
            }
        } else {
            throw new Dom\Exception('There is no XSL template to transform with.');
        }

        try {
            return $htmlDomDocument->toString(false);
        } catch (\Exception $exception) {
            $this->logger->error($exception->getMessage());
            throw new Dom\Exception("dom-transform-failed");
        }
    }