cvs: phpdoc /en/functions xslt.xml
| From: | Sterling Hughes | Date: | Sat, 25 Nov 2000 17:25:33 +0000 |
| Subject: | cvs: phpdoc /en/functions xslt.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969333076@lists.php.net to get a copy of this message | ||
sterling Sat Nov 25 09:25:33 2000 EDT
Modified files:
/phpdoc/en/functions xslt.xml
Log:
Add some more documentation...
Index: phpdoc/en/functions/xslt.xml diff -u phpdoc/en/functions/xslt.xml:1.4 phpdoc/en/functions/xslt.xml:1.5 --- phpdoc/en/functions/xslt.xml:1.4 Sun Nov 12 23:49:22 2000 +++ phpdoc/en/functions/xslt.xml Sat Nov 25 09:25:32 2000 @@ -29,9 +29,8 @@ </para> <para> On UNIX, run <command>configure</command> with the <option - role="configure">--with-sablot</option> and <option - role="configure">--enable-sablot-errors-descriptive</option> - options. The <productname>Sablotron</productname> library + role="configure">--with-sablot</option>. + The <productname>Sablotron</productname> library should be installed somewhere your compiler can find it. </para> </sect2> @@ -222,63 +221,168 @@ <refentry id="function.xslt-output-begintransform"> <refnamediv> <refname>xslt_output_begintransform</refname> - <refpurpose>unknown</refpurpose> + <refpurpose>Begin an XSLT transformation on the output</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_output_begintransform</function></funcdef> + <funcdef>void + <function>xslt_output_begintransform</function> + </funcdef> <paramdef> - <parameter>unknown</parameter> + <parameter>string xslt_filename/parameter> </paramdef> </funcprototype> </funcsynopsis> <para> - This function lacks a prototype definition. + This function will begin the output transformation on your data. + From the point you call <function>xslt_output_begintransform</function> + till the point you call <function>xslt_output_endtransform</function> + all output will be transformed through the xslt stylesheet given by + the first argument. </para> + <para> + <example> + <title> + Transforming output through an XSLT stylesheet, using the DOM-XML functions for xml generation + </title> + <programlisting role="php"> +<?php + +$xsl_file = "article.xsl"; +xslt_output_begintransform($xsl_file); + +$doc = new_xmldoc('1.0'); +$article = $doc->new_root('article'); + +$article->new_child('title', 'The History of South Tyrol'); +$article->new_child('author', 'Sterling Hughes'); +$article->new_child('body', 'Back after WWI, Italy gained South Tyrol from + Austria. Since that point nothing interesting has + happened'); + +echo $doc->dumpmem(); + +xslt_output_endtransform(); + </programlisting> + </example> + </para> </refsect1> </refentry> <refentry id="function.xslt-output-endtransform"> <refnamediv> <refname>xslt_output_endtransform</refname> - <refpurpose>unknown</refpurpose> + <refpurpose>End an output transformation started with xslt_output_begintransform</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_output_endtransform</function></funcdef> - <paramdef> - <parameter>unknown</parameter> - </paramdef> + <funcdef>void + <function>xslt_output_endtransform</function> + </funcdef> + </void> </funcprototype> </funcsynopsis> <para> - This function lacks a prototype definition. + The <function>xslt_output_endtransform</function> ends the output transformation + started by the <function>xslt_output_begintransform() function. You must call + this function in order to see the results of the output transformation. </para> </refsect1> </refentry> <refentry id="function.xslt-process"> <refnamediv> - <refname>xslt_output_process</refname> - <refpurpose>unknown</refpurpose> + <refname>xslt_process</refname> + <refpurpose>Transform XML data through a string containing XSL data</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_process</function></funcdef> - <paramdef> - <parameter>unknown</parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function lacks a prototype definition. - </para> + <funcdef>bool + <function>xslt_process</function> + </funcdef> + <paramdef> + <parameter>string xsl_data</parameter> + <parameter>string xml_data</parameter> + <parameter>string result</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + The <function>xslt_process</function> takes a string containing the XSLT stylesheet as + its first argument, it takes a second string containing the XML data you want to + transform and then a third string containing the results of the transformation. + <function>xslt_process</function> will return true on success and false on failure, + to get the error number and error string if an error occurs use the + <function>xslt_errno</function> and <function>xslt_error</function> functions. + </para> + <para> + <example> + <title>Using the <function>xslt_process</function> to transform three strings</title> + <programlisting role="php"> +<?php + +$xslData = ' +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="article"> + <table border="1" cellpadding="2" cellspacing="1"> + <tr> + <td width="20%"> + + </title> + <td width="80%"> + <h2><xsl:value-of select="title"></h2> + <h3><xsl:value-of select="author"></h3> + <br> + + <xsl:value-of select="body"> + </td> + </tr> + </table> +</xsl:template> + +</xsl:stylesheet>'; + +$xmlData = ' +<?xml version="1.0"?> +<article> + <title>Learning German</title> + <author>Sterling Hughes</author> + <body> + Essential phrases: + <br> + <br> + Komme sie mir sagen, woe die toilette es?<br> + Eine grande beer bitte!<br> + Noch einem bitte.<br> + </body> +</article>'; + +if (xslt_process($xslData, $xmlData, $result)) +{ + echo "Here is the brilliant in-depth article on learning" + echo " German: "; + echo "<br>\n<br>"; + echo $result; +} +else +{ + echo "There was an error that occurred in the XSL transformation...\n"; + echo "\tError number: " . xslt_errno() . "\n"; + echo "\tError string: " . xslt_error() . "\n"; + exit; +} +?> + </programlisting> + </example> </refsect1> </refentry> @@ -328,7 +432,7 @@ </funcprototype> </funcsynopsis> <para> - Set SAX handlers on the ressource handle given by xh. + Set SAX handlers on the resource handle given by xh. </para> </refsect1> </refentry> @@ -336,20 +440,28 @@ <refentry id="function.xslt-transform"> <refnamediv> <refname>xslt_transform</refname> - <refpurpose>unknown</refpurpose> + <refpurpose>Perform an XSLT transformation</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_transform</function></funcdef> - <paramdef> - <parameter>unknown</parameter> + <funcdef>bool + <function>xslt_transform</function> + </funcdef> + <paramdef> + <parameter>string xsl</parameter> + <parameter>string xml</parameters> + <parameter>string result</parameter> + <parameter>string params</parameter> + <parameter>string args</parameter> + <parameter>string resultBuffer</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> - This function lacks a prototype definition. + The <function>xslt_transform</function> provides an interface to sablotron's + more advanced features without requiring you to use the resource API. </para> </refsect1> </refentry>
Index: phpdoc/en/functions/xslt.xml diff -u phpdoc/en/functions/xslt.xml:1.4 phpdoc/en/functions/xslt.xml:1.5 --- phpdoc/en/functions/xslt.xml:1.4 Sun Nov 12 23:49:22 2000 +++ phpdoc/en/functions/xslt.xml Sat Nov 25 09:25:32 2000 @@ -29,9 +29,8 @@ </para> <para> On UNIX, run <command>configure</command> with the <option - role="configure">--with-sablot</option> and <option - role="configure">--enable-sablot-errors-descriptive</option> - options. The <productname>Sablotron</productname> library + role="configure">--with-sablot</option>. + The <productname>Sablotron</productname> library should be installed somewhere your compiler can find it. </para> </sect2> @@ -222,63 +221,168 @@ <refentry id="function.xslt-output-begintransform"> <refnamediv> <refname>xslt_output_begintransform</refname> - <refpurpose>unknown</refpurpose> + <refpurpose>Begin an XSLT transformation on the output</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_output_begintransform</function></funcdef> + <funcdef>void + <function>xslt_output_begintransform</function> + </funcdef> <paramdef> - <parameter>unknown</parameter> + <parameter>string xslt_filename/parameter> </paramdef> </funcprototype> </funcsynopsis> <para> - This function lacks a prototype definition. + This function will begin the output transformation on your data. + From the point you call <function>xslt_output_begintransform</function> + till the point you call <function>xslt_output_endtransform</function> + all output will be transformed through the xslt stylesheet given by + the first argument. </para> + <para> + <example> + <title> + Transforming output through an XSLT stylesheet, using the DOM-XML functions for xml generation + </title> + <programlisting role="php"> +<?php + +$xsl_file = "article.xsl"; +xslt_output_begintransform($xsl_file); + +$doc = new_xmldoc('1.0'); +$article = $doc->new_root('article'); + +$article->new_child('title', 'The History of South Tyrol'); +$article->new_child('author', 'Sterling Hughes'); +$article->new_child('body', 'Back after WWI, Italy gained South Tyrol from + Austria. Since that point nothing interesting has + happened'); + +echo $doc->dumpmem(); + +xslt_output_endtransform(); + </programlisting> + </example> + </para> </refsect1> </refentry> <refentry id="function.xslt-output-endtransform"> <refnamediv> <refname>xslt_output_endtransform</refname> - <refpurpose>unknown</refpurpose> + <refpurpose>End an output transformation started with xslt_output_begintransform</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_output_endtransform</function></funcdef> - <paramdef> - <parameter>unknown</parameter> - </paramdef> + <funcdef>void + <function>xslt_output_endtransform</function> + </funcdef> + </void> </funcprototype> </funcsynopsis> <para> - This function lacks a prototype definition. + The <function>xslt_output_endtransform</function> ends the output transformation + started by the <function>xslt_output_begintransform() function. You must call + this function in order to see the results of the output transformation. </para> </refsect1> </refentry> <refentry id="function.xslt-process"> <refnamediv> - <refname>xslt_output_process</refname> - <refpurpose>unknown</refpurpose> + <refname>xslt_process</refname> + <refpurpose>Transform XML data through a string containing XSL data</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_process</function></funcdef> - <paramdef> - <parameter>unknown</parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - <para> - This function lacks a prototype definition. - </para> + <funcdef>bool + <function>xslt_process</function> + </funcdef> + <paramdef> + <parameter>string xsl_data</parameter> + <parameter>string xml_data</parameter> + <parameter>string result</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + The <function>xslt_process</function> takes a string containing the XSLT stylesheet as + its first argument, it takes a second string containing the XML data you want to + transform and then a third string containing the results of the transformation. + <function>xslt_process</function> will return true on success and false on failure, + to get the error number and error string if an error occurs use the + <function>xslt_errno</function> and <function>xslt_error</function> functions. + </para> + <para> + <example> + <title>Using the <function>xslt_process</function> to transform three strings</title> + <programlisting role="php"> +<?php + +$xslData = ' +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="article"> + <table border="1" cellpadding="2" cellspacing="1"> + <tr> + <td width="20%"> + + </title> + <td width="80%"> + <h2><xsl:value-of select="title"></h2> + <h3><xsl:value-of select="author"></h3> + <br> + + <xsl:value-of select="body"> + </td> + </tr> + </table> +</xsl:template> + +</xsl:stylesheet>'; + +$xmlData = ' +<?xml version="1.0"?> +<article> + <title>Learning German</title> + <author>Sterling Hughes</author> + <body> + Essential phrases: + <br> + <br> + Komme sie mir sagen, woe die toilette es?<br> + Eine grande beer bitte!<br> + Noch einem bitte.<br> + </body> +</article>'; + +if (xslt_process($xslData, $xmlData, $result)) +{ + echo "Here is the brilliant in-depth article on learning" + echo " German: "; + echo "<br>\n<br>"; + echo $result; +} +else +{ + echo "There was an error that occurred in the XSL transformation...\n"; + echo "\tError number: " . xslt_errno() . "\n"; + echo "\tError string: " . xslt_error() . "\n"; + exit; +} +?> + </programlisting> + </example> </refsect1> </refentry> @@ -328,7 +432,7 @@ </funcprototype> </funcsynopsis> <para> - Set SAX handlers on the ressource handle given by xh. + Set SAX handlers on the resource handle given by xh. </para> </refsect1> </refentry> @@ -336,20 +440,28 @@ <refentry id="function.xslt-transform"> <refnamediv> <refname>xslt_transform</refname> - <refpurpose>unknown</refpurpose> + <refpurpose>Perform an XSLT transformation</refpurpose> </refnamediv> <refsect1> <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>unknown <function>xslt_transform</function></funcdef> - <paramdef> - <parameter>unknown</parameter> + <funcdef>bool + <function>xslt_transform</function> + </funcdef> + <paramdef> + <parameter>string xsl</parameter> + <parameter>string xml</parameters> + <parameter>string result</parameter> + <parameter>string params</parameter> + <parameter>string args</parameter> + <parameter>string resultBuffer</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> - This function lacks a prototype definition. + The <function>xslt_transform</function> provides an interface to sablotron's + more advanced features without requiring you to use the resource API. </para> </refsect1> </refentry>