note 69305 added to function.xsl-xsltprocessor-transform-to-doc

From: Date: Thu, 31 Aug 2006 00:16:51 +0000
Subject: note 69305 added to function.xsl-xsltprocessor-transform-to-doc
Groups: php.notes 
Request: Send a blank email to php-notes+get-116526@lists.php.net to get a copy of this message
In most cases if you expect XML (or XHTML) as output you better use transformToXML() directly. You gain better control over xsl:output attributes, notably omit-xml-declaration. Instead of : $proc = new XSLTProcessor(); $proc->importStylesheet($xsl); $dom = $proc->transformToDoc($xml); echo $dom->saveXML(); do use : $proc = new XSLTProcessor(); $proc->importStylesheet($xsl); $newXml = $proc->transformToXML($xml); echo $newXml; In the first case, <?xml version="1.0" encoding="utf-8"?> is added whatever you set the omit-xml-declaration while transformToXML() take the attribute into account. ---- Server IP: 66.163.161.117 Probable Submitter: 195.154.42.26 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.xsl-xsltprocessor-transform-to-doc.php Edit -- https://master.php.net/note/edit/69305 Del: integrated -- https://master.php.net/note/delete/69305/integrated Del: useless -- https://master.php.net/note/delete/69305/useless Del: bad code -- https://master.php.net/note/delete/69305/bad+code Del: spam -- https://master.php.net/note/delete/69305/spam Del: non-english -- https://master.php.net/note/delete/69305/non-english Del: in docs -- https://master.php.net/note/delete/69305/in+docs Del: other reasons-- https://master.php.net/note/delete/69305 Reject -- https://master.php.net/note/reject/69305 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116526) next »