PDF generation is very slow when the document contains svg:text elements. When I remove the svg:text elements, the pdf generation is very fast.
I attached the xml and xsl files to test the behavior. When lines 314-343 are commented out (svg:text elements), pdf generation is quick.
Note: a single svg:text element is sufficient to slow down the generation process.
If there is any further information I should provide in order to tackle this problem, I'll try to provide it.