note 23724 added to ref.domxml
| From: | chiefgeek@php.net | Date: | Thu, 25 Jul 2002 21:13:58 +0000 |
| Subject: | note 23724 added to ref.domxml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33567@lists.php.net to get a copy of this message | ||
With the release of PHP 4.2.0 exslt integration in the domxml extension was added. This can be
configured using
./configure --with-dom-exslt[=DIR] (and --with-dom-xslt) as can be seen in the changelog.
The set of classes and methods that have been added are undocumented. After scouring the search
engines I still came up with nothing...so I did a little digging on my own. This is what I have
found so far. I'll just list new functions and classes then give some examples.
There are 5 new functions added: (I don't know all the paremeters yet, but this is what i do
know)
FUNCTIONS:
=> domxml_xslt_version
=> domxml_xslt_stylesheet
=> domxml_xslt_stylesheet_doc
=> domxml_xslt_stylesheet_file
=> domxml_xslt_process
Function explanations:
=> domxml_xslt_version() - Have a guess what this does. Hint it returns a string.
=> domxml_xslt_stylesheet - expects only 1 parameter, a string representation of an XSLT
document. Returns an object of class XsltStylesheet
=> domxml_xslt_stylesheet_doc - not sure about this one yet, it takes just one parameter, an
object. What kind? Beats me.
=> domxml_xslt_stylesheet_file - just 1 parameter, the filename (as a string) of an XSLT doc.
Returns an object of class XsltStylesheet
=> domxml_xslt_process (?) still working on this one..
NEW CLASSES, as far as i can tell:
Class Name:
XsltStylesheet
Methods:
=>process
=> process - as far as I can tell this method takes in a DomDocument representation of an XML
file and returns a translated DomDocument.
Now for an example:
(Assume person.xml is a properly fomatted XML document. Same goes for person.xsl.)
<?php
// Create a DOM representation of the xsl file
$xsltdom = domxml_xslt_stylesheet_file("person.xsl");
// Create a DOM representation of the xml file
$xmldom = domxml_open_file("person.xml");
//Now for the magic
$result = $xsltdom->process($xmldom);
// Finally dump the contents to the browser
echo $result->html_dump_mem();
/**
* Note $result is an object of class DomDocument and so many
* methods can be used to modify and dump it to the browser.
*
* In actual fact $result is an XML representation of an HTML document
*/
?>
--
http://www.php.net/manual/en/ref.domxml.php
http://master.php.net/manage/user-notes.php?action=edit+23724
http://master.php.net/manage/user-notes.php?action=delete+23724
http://master.php.net/manage/user-notes.php?action=reject+23724