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 @@ On UNIX, run configure with the and - options. The Sablotron library + role="configure">--with-sablot. + The Sablotron library should be installed somewhere your compiler can find it. @@ -222,63 +221,168 @@ xslt_output_begintransform - unknown + Begin an XSLT transformation on the output Description - unknown xslt_output_begintransform + void + xslt_output_begintransform + - unknown + string xslt_filename/parameter> - This function lacks a prototype definition. + This function will begin the output transformation on your data. + From the point you call xslt_output_begintransform + till the point you call xslt_output_endtransform + all output will be transformed through the xslt stylesheet given by + the first argument. + + + + Transforming output through an XSLT stylesheet, using the DOM-XML functions for xml generation + + +<?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(); + + + xslt_output_endtransform - unknown + End an output transformation started with xslt_output_begintransform Description - unknown xslt_output_endtransform - - unknown - + void + xslt_output_endtransform + + - This function lacks a prototype definition. + The xslt_output_endtransform ends the output transformation + started by the xslt_output_begintransform() function. You must call + this function in order to see the results of the output transformation. - xslt_output_process - unknown + xslt_process + Transform XML data through a string containing XSL data Description - unknown xslt_process - - unknown - - - - - This function lacks a prototype definition. - + bool + xslt_process + + + string xsl_data + string xml_data + string result + + + + + The xslt_process 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. + xslt_process will return true on success and false on failure, + to get the error number and error string if an error occurs use the + xslt_errno and xslt_error functions. + + + + Using the <function>xslt_process</function> to transform three strings + +<?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 "
\n
"; + 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; +} +?> +
+
@@ -328,7 +432,7 @@ - Set SAX handlers on the ressource handle given by xh. + Set SAX handlers on the resource handle given by xh. @@ -336,20 +440,28 @@ xslt_transform - unknown + Perform an XSLT transformation Description - unknown xslt_transform - - unknown + bool + xslt_transform + + + string xsl + string xml + string result + string params + string args + string resultBuffer - This function lacks a prototype definition. + The xslt_transform provides an interface to sablotron's + more advanced features without requiring you to use the resource API.