Manuál PHP | ||
---|---|---|
PÅ™edcházejÃcà | Dalšà |
xslt_set_sax_handlers
(PHP 4 >= 4.0.6, PECL)
xslt_set_sax_handlers -- Set the SAX handlers to be called when the XML document gets processedDescription
void xslt_set_sax_handlers ( resource processor, array handlers )
xslt_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 |
Poznámka: 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.
PÅ™Ãklady
You can also use xslt_set_object() if you want to implement your handlers in an object.
PÅ™Ãklad 2. Object oriented handler
Both examples will output:
|
PÅ™edcházejÃcà | Domů | Dalšà |
xslt_set_sax_handler | Nahoru |