php-doc-en/reference/xsl/functions/xsl-xsltprocessor-transform-to-doc.xml

110 lines
2.6 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<refentry id="function.xsl-xsltprocessor-transform-to-doc">
<refnamediv>
<refname>XSLTProcessor->transformToDoc()</refname>
<refpurpose>Transform to a DOMDocument</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>XSLTProcessor</classname></ooclass>
<methodsynopsis>
<type>DOMDocument</type>
<methodname>transformToDoc</methodname>
<methodparam><type>DOMNode</type><parameter>doc</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
Transforms the source node to a <classname>DOMDocument</classname> applying
the stylesheet given by the <xref
linkend="function.xsl-xsltprocessor-import-stylesheet" /> method.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>doc</parameter></term>
<listitem>
<para>
The node to be transformed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The resulting <classname>DOMDocument</classname> or &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Transforming to a DOMDocument</title>
<programlisting role="php">
<![CDATA[
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');
$xsl = new DOMDocument;
$xsl->load('collection.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo trim($proc->transformToDoc($xml)->firstChild->wholeText);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection!
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><xref linkend="function.xsl-xsltprocessor-transform-to-uri" /></member>
<member><xref linkend="function.xsl-xsltprocessor-transform-to-xml" /></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->