didou Wed May 19 16:47:51 2004 EDT
Modified files:
/phpdoc/en/reference/xslt/functions xslt-backend-info.xml
xslt-backend-name.xml
xslt-backend-version.xml
xslt-errno.xml xslt-error.xml
xslt-process.xml
xslt-set-error-handler.xml
Log:
added docs for xslt_backend_XXX,
see also for err(no|or)
improved the documentation about the error handler function
added an example about passing PHP variables to XSL sheets
# thanks to all the notes submitters
# I'm under win, I'll make test soon after the commit
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-backend-info.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-backend-info.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-backend-info.xml:1.1
phpdoc/en/reference/xslt/functions/xslt-backend-info.xml:1.2
--- phpdoc/en/reference/xslt/functions/xslt-backend-info.xml:1.1 Wed May 19
12:01:20 2004
+++ phpdoc/en/reference/xslt/functions/xslt-backend-info.xml Wed May 19 16:47:51
2004
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<refentry id="function.xslt-backend-info">
<refnamediv>
<refname>xslt_backend_info</refname>
@@ -13,9 +13,16 @@
<type>string</type><methodname>xslt_backend_info</methodname>
<void/>
</methodsynopsis>
-
- &warn.undocumented.func;
-
+ <para>
+ <function>xslt_backend_info</function> returns a string with
+ information about the compilation setting of the backend
+ or an error string when no information available.
+ </para>
+ <para>
+ See also
+ <function>xslt_backend_name</function> and
+ <function>xslt_backend_version</function>.
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-backend-name.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-backend-name.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-backend-name.xml:1.1
phpdoc/en/reference/xslt/functions/xslt-backend-name.xml:1.2
--- phpdoc/en/reference/xslt/functions/xslt-backend-name.xml:1.1 Wed May 19
12:01:20 2004
+++ phpdoc/en/reference/xslt/functions/xslt-backend-name.xml Wed May 19 16:47:51
2004
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<refentry id="function.xslt-backend-name">
<refnamediv>
<refname>xslt_backend_name</refname>
<refpurpose>
- Returns the name of the Backend
+ Returns the name of the backend
</refpurpose>
</refnamediv>
<refsect1>
@@ -13,9 +13,29 @@
<type>string</type><methodname>xslt_backend_name</methodname>
<void/>
</methodsynopsis>
+ <para>
+ <function>xslt_backend_name</function> will always return
+ <productname>Sablotron</productname>.
+ </para>
+ <para>
+ <example>
+ <title><function>xslt_backend_name</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
- &warn.undocumented.func;
+echo xslt_backend_name(); // Sablotron
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ See also
+ <function>xslt_backend_info</function> and
+ <function>xslt_backend_version</function>.
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-backend-version.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-backend-version.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-backend-version.xml:1.1
phpdoc/en/reference/xslt/functions/xslt-backend-version.xml:1.2
--- phpdoc/en/reference/xslt/functions/xslt-backend-version.xml:1.1 Wed May 19
12:01:20 2004
+++ phpdoc/en/reference/xslt/functions/xslt-backend-version.xml Wed May 19 16:47:51
2004
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<refentry id="function.xslt-backend-version">
<refnamediv>
<refname>xslt_backend_version</refname>
<refpurpose>
- Returns the version number of Sablotron (if available)
+ Returns the version number of Sablotron
</refpurpose>
</refnamediv>
<refsect1>
@@ -13,9 +13,30 @@
<type>string</type><methodname>xslt_backend_version</methodname>
<void/>
</methodsynopsis>
+ <para>
+ <function>xslt_backend_version</function> returns the version
+ number of <productname>Sablotron</productname> if available,
+ &false otherwise.
+ </para>
+ <para>
+ <example>
+ <title><function>xslt_backend_version</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
- &warn.undocumented.func;
+echo xslt_backend_version(); // 0.98 for example
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ See also
+ <function>xslt_backend_name</function> and
+ <function>xslt_backend_info</function>.
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-errno.xml?r1=1.4&r2=1.5&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-errno.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-errno.xml:1.4
phpdoc/en/reference/xslt/functions/xslt-errno.xml:1.5
--- phpdoc/en/reference/xslt/functions/xslt-errno.xml:1.4 Fri Dec 19 10:50:05
2003
+++ phpdoc/en/reference/xslt/functions/xslt-errno.xml Wed May 19 16:47:51 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/xslt.xml, last change in rev 1.3 -->
<refentry id="function.xslt-errno">
<refnamediv>
@@ -16,6 +16,9 @@
Returns an error code describing the last error that occurred on the
passed XSLT processor.
</para>
+ <para>
+ See also <function>xslt_error</function>.
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-error.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-error.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-error.xml:1.5
phpdoc/en/reference/xslt/functions/xslt-error.xml:1.6
--- phpdoc/en/reference/xslt/functions/xslt-error.xml:1.5 Fri Dec 19 10:50:05
2003
+++ phpdoc/en/reference/xslt/functions/xslt-error.xml Wed May 19 16:47:51 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/xslt.xml, last change in rev 1.3 -->
<refentry id="function.xslt-error">
<refnamediv>
@@ -41,6 +41,9 @@
</programlisting>
</example>
</para>
+ <para>
+ See also <function>xslt_errno</function>.
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-process.xml?r1=1.12&r2=1.13&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-process.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-process.xml:1.12
phpdoc/en/reference/xslt/functions/xslt-process.xml:1.13
--- phpdoc/en/reference/xslt/functions/xslt-process.xml:1.12 Wed May 19 14:46:47
2004
+++ phpdoc/en/reference/xslt/functions/xslt-process.xml Wed May 19 16:47:51 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.12 $ -->
+<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/xslt.xml, last change in rev 1.3 -->
<refentry id="function.xslt-process">
<refnamediv>
@@ -168,11 +168,67 @@
<para>
Finally, the last argument to the <function>xslt_process</function>
function represents an array for any top-level parameters that you want to
- pass to the XSLT document. These parameters can then be accessed within
+ pass to the XSLT document. These parameters can then be accessed within
your XSL files using the <xsl:param name="parameter_name">
instruction. The parameters must be UTF-8 encoded and their values will be
- interpreted as strings by the Sablotron processor. In other words - you
- cannot pass node-sets as parameters to the XSLT document.
+ interpreted as strings by the <productname>Sablotron</productname> processor.
+ In other words - you cannot pass node-sets as parameters to the XSLT document.
+ </para>
+ <para>
+ <example>
+ <title></title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+// XML string
+$xml = '<?xml version="1.0"?>
+<para>
+ change me
+</para>';
+
+// XSL string
+$xsl = '
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="html" encoding="ISO-8859-1" indent="no"
+ omit-xml-declaration="yes" media-type="text/html"/>
+ <xsl:param name="myvar"/>
+ <xsl:param name="mynode"/>
+ <xsl:template match="/">
+My PHP variable : <xsl:value-of select="$myvar"/><br />
+My node set : <xsl:value-of select="$mynode"/>
+ </xsl:template>
+</xsl:stylesheet>';
+
+
+$xh = xslt_create();
+
+// the second parameter will be interpreted as a string
+$parameters = array (
+ 'myvar' => 'test',
+ 'mynode' => '<foo>bar</foo>'
+);
+
+$arguments = array (
+ '/_xml' => $xml,
+ '/_xsl' => $xsl
+);
+
+echo xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments, $parameters);
+
+?>
+]]>
+ </programlisting>
+ <para>
+ this will produce:
+ </para>
+ <screen>
+<![CDATA[
+My PHP variable : test<br>
+My node set : <foo>bar</foo>
+]]>
+ </screen>
+ </example>
</para>
¬e.xslt.windows;
</refsect1>
http://cvs.php.net/diff.php/phpdoc/en/reference/xslt/functions/xslt-set-error-handler.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/xslt/functions/xslt-set-error-handler.xml
diff -u phpdoc/en/reference/xslt/functions/xslt-set-error-handler.xml:1.2
phpdoc/en/reference/xslt/functions/xslt-set-error-handler.xml:1.3
--- phpdoc/en/reference/xslt/functions/xslt-set-error-handler.xml:1.2 Wed Apr 17
02:45:24 2002
+++ phpdoc/en/reference/xslt/functions/xslt-set-error-handler.xml Wed May 19
16:47:51 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/xslt.xml, last change in rev 1.1 -->
<refentry id="function.xslt-set-error-handler">
<refnamediv>
@@ -14,9 +14,96 @@
<methodparam><type>mixed</type><parameter>handler</parameter></methodparam>
</methodsynopsis>
<para>
- Set an error handler function for the XSLT processor given by
<parameter>xh</parameter>,
- this function will be called whenever an error occurs in the XSLT transformation
- (this function is also called for notices).
+ Set an error handler function for the XSLT processor given by
+ <parameter>xh</parameter>, this function will be called whenever an
+ error occurs in the XSLT transformation (this function is also called
+ for notices).
+ </para>
+ <para>
+ The user function needs to accept four parameters: the XSLT processor,
+ the error level, the error code and an array of messages. The function
+ can be shown as:
+ <methodsynopsis>
+ <methodname><replaceable>error_handler</replaceable></methodname>
+ <methodparam><type>resource</type><parameter>xh</parameter></methodparam>
+ <methodparam><type>int</type><parameter>error_level</parameter></methodparam>
+ <methodparam><type>int</type><parameter>error_code</parameter></methodparam>
+ <methodparam><type>array</type><parameter>messages</parameter></methodparam>
+ </methodsynopsis>
+ </para>
+ <para>
+ <example>
+ <title><function>xslt_set_error_handler</function> Example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+// Our XSLT error handler
+function xslt_error_handler($handler, $errno, $level, $info)
+{
+ // for now, let's just see the arguments
+ var_dump(func_get_args());
+}
+
+// XML content :
+$xml='<?xml version="1.0"?>
+<para>
+ oops, I misspelled the closing tag
+</pata>';
+
+// XSL content :
+$xsl='<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/">
+ <strong><xsl:value-of select="para"/></strong>
+</xsl:template>
+</xsl:stylesheet>';
+
+$xh = xslt_create();
+
+xslt_set_error_handler($xh, "xslt_error_handler");
+
+echo xslt_process($xh, 'arg:/_xml', 'arg:/_xsl',
+ NULL, array("/_xml" => $xml, "/_xsl" => $xsl));
+
+?>
+]]>
+ </programlisting>
+ <para>
+ This example will output something similar to:
+ </para>
+ <screen>
+<![CDATA[
+array(4) {
+ [0]=>
+ resource(1) of type (XSLT Processor)
+ [1]=>
+ int(3)
+ [2]=>
+ int(0)
+ [3]=>
+ array(6) {
+ ["msgtype"]=>
+ string(5) "error"
+ ["code"]=>
+ string(1) "2"
+ ["module"]=>
+ string(9) "Sablotron"
+ ["URI"]=>
+ string(9) "arg:/_xml"
+ ["line"]=>
+ string(1) "4"
+ ["msg"]=>
+ string(34) "XML parser error 7: mismatched tag"
+ }
+}
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ Instead of a function name, an array containing an object reference and
+ a method name can also be supplied.
</para>
</refsect1>
</refentry>