|
(PHP 4 >= 4.0.6, PECL)
xslt_set_sax_handlers -- Set the SAX handlers to be called when the XML document gets processedxslt_set_sax_handlers() registers the SAX handlers for the document, given a XSLT processor resource.
handlers should be an array in the following format:
<?php |
Nota: The given array does not need to contain all of the different sax handler elements (although it can), but it only needs to conform to "handler" => "function" format described above.
Each of the individual SAX handler functions are in the format below:
start_doc ( resource processor )
end_doc ( resource processor )
start_element ( resource processor, string name, array attributes )
end_element ( resource processor, string name )
start_namespace ( resource processor, string prefix, string uri )
end_namespace ( resource processor, string prefix )
comment ( resource processor, string contents )
pi ( resource processor, string target, string contents )
characters ( resource processor, string contents )
Using xslt_set_sax_handlers() doesn't look very different than running a SAX parser like xml_parse() on the result of an xslt_process() transformation.
You can also use xslt_set_object() if you want to implement your handlers in an object.
Ejemplo 2. Object oriented handler
Both examples will output:
|
Hosting by: hurra.com
Generated: 2007-01-26 18:00:51