Server-Side XSLT Render (Perl)


sub renderPage {
   $response_payload = shift;
   $document = XML::LibXML->createDocument;
   $document->setDocumentElement($response_payload);
   $xslt = XML::LibXSLT->new();
   $stylesheet = $xslt->parse_stylesheet_file(
        "myStylesheet.xslt" );
   $pageTitle = "Example XSLT";
   $xslt_result = $stylesheet->transform(
      $document,
      XML::LibXSLT::xpath_to_string (
         pagetitle => $pageTitle )
      );
   return $stylesheet->output_string($xslt_result);
}