From 448bb6c1f955e2ca8227f226aa2e3d4239d5f472 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Wed, 19 May 2004 20:47:51 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@159074 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../xslt/functions/xslt-backend-info.xml | 15 ++- .../xslt/functions/xslt-backend-name.xml | 26 ++++- .../xslt/functions/xslt-backend-version.xml | 27 +++++- reference/xslt/functions/xslt-errno.xml | 5 +- reference/xslt/functions/xslt-error.xml | 5 +- reference/xslt/functions/xslt-process.xml | 64 ++++++++++++- .../xslt/functions/xslt-set-error-handler.xml | 95 ++++++++++++++++++- 7 files changed, 217 insertions(+), 20 deletions(-) diff --git a/reference/xslt/functions/xslt-backend-info.xml b/reference/xslt/functions/xslt-backend-info.xml index c2f72b765d..4e82fbcc75 100755 --- a/reference/xslt/functions/xslt-backend-info.xml +++ b/reference/xslt/functions/xslt-backend-info.xml @@ -1,5 +1,5 @@ - + xslt_backend_info @@ -13,9 +13,16 @@ stringxslt_backend_info - - &warn.undocumented.func; - + + xslt_backend_info returns a string with + information about the compilation setting of the backend + or an error string when no information available. + + + See also + xslt_backend_name and + xslt_backend_version. + diff --git a/reference/xslt/functions/xslt-backend-name.xml b/reference/xslt/functions/xslt-backend-name.xml index 56c27aae06..3c51ca0d25 100755 --- a/reference/xslt/functions/xslt-backend-name.xml +++ b/reference/xslt/functions/xslt-backend-name.xml @@ -1,10 +1,10 @@ - + xslt_backend_name - Returns the name of the Backend + Returns the name of the backend @@ -13,9 +13,29 @@ stringxslt_backend_name + + xslt_backend_name will always return + Sablotron. + + + + <function>xslt_backend_name</function> example + + +]]> + + + + + See also + xslt_backend_info and + xslt_backend_version. + diff --git a/reference/xslt/functions/xslt-backend-version.xml b/reference/xslt/functions/xslt-backend-version.xml index 97ba663624..6fff6cbe5a 100755 --- a/reference/xslt/functions/xslt-backend-version.xml +++ b/reference/xslt/functions/xslt-backend-version.xml @@ -1,10 +1,10 @@ - + xslt_backend_version - Returns the version number of Sablotron (if available) + Returns the version number of Sablotron @@ -13,9 +13,30 @@ stringxslt_backend_version + + xslt_backend_version returns the version + number of Sablotron if available, + &false otherwise. + + + + <function>xslt_backend_version</function> example + + +]]> + + + + + See also + xslt_backend_name and + xslt_backend_info. + diff --git a/reference/xslt/functions/xslt-errno.xml b/reference/xslt/functions/xslt-errno.xml index 7aec12b2d7..8389955a69 100644 --- a/reference/xslt/functions/xslt-errno.xml +++ b/reference/xslt/functions/xslt-errno.xml @@ -1,5 +1,5 @@ - + @@ -16,6 +16,9 @@ Returns an error code describing the last error that occurred on the passed XSLT processor. + + See also xslt_error. + diff --git a/reference/xslt/functions/xslt-error.xml b/reference/xslt/functions/xslt-error.xml index e115f9aace..f4ad3dd5be 100644 --- a/reference/xslt/functions/xslt-error.xml +++ b/reference/xslt/functions/xslt-error.xml @@ -1,5 +1,5 @@ - + @@ -41,6 +41,9 @@ xslt_free($xh); + + See also xslt_errno. + diff --git a/reference/xslt/functions/xslt-process.xml b/reference/xslt/functions/xslt-process.xml index 1000c55b65..2de7a546a1 100644 --- a/reference/xslt/functions/xslt-process.xml +++ b/reference/xslt/functions/xslt-process.xml @@ -1,5 +1,5 @@ - + @@ -168,11 +168,67 @@ xslt_free($xh); Finally, the last argument to the xslt_process 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 Sablotron processor. + In other words - you cannot pass node-sets as parameters to the XSLT document. + + + + + + + + change me +'; + +// XSL string +$xsl = ' + + + + + +My PHP variable :
+My node set : +
+
'; + + +$xh = xslt_create(); + +// the second parameter will be interpreted as a string +$parameters = array ( + 'myvar' => 'test', + 'mynode' => 'bar' +); + +$arguments = array ( + '/_xml' => $xml, + '/_xsl' => $xsl +); + +echo xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments, $parameters); + +?> +]]> +
+ + this will produce: + + + +My node set : <foo>bar</foo> +]]> + +
¬e.xslt.windows; diff --git a/reference/xslt/functions/xslt-set-error-handler.xml b/reference/xslt/functions/xslt-set-error-handler.xml index aded4b0ff9..3148923701 100644 --- a/reference/xslt/functions/xslt-set-error-handler.xml +++ b/reference/xslt/functions/xslt-set-error-handler.xml @@ -1,5 +1,5 @@ - + @@ -14,9 +14,96 @@ mixedhandler - Set an error handler function for the XSLT processor given by xh, - 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 + xh, this function will be called whenever an + error occurs in the XSLT transformation (this function is also called + for notices). + + + 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: + + error_handler + resourcexh + interror_level + interror_code + arraymessages + + + + + <function>xslt_set_error_handler</function> Example + + + + oops, I misspelled the closing tag +'; + +// XSL content : +$xsl=' + + + + +'; + +$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)); + +?> +]]> + + + This example will output something similar to: + + + + 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" + } +} +]]> + + + + + Instead of a function name, an array containing an object reference and + a method name can also be supplied.