How can I use php function inside XSLT?
XSLT will produce a stream of output, but it's not easy to manipulate it. If you need to process the data as it's parsed you would probably be better off with a parser like sablotron and callback functions.