How to preserve processing instructions whilst producing XSL-FO in eXist-db?

249 views Asked by At

Is there a way to make eXist to return processing instruction as it is? It seems it somehow ignores it in the output.

Processing instructions are very useful if I use XEP as my rendering engine, hence it would be great to be able to preserve them before the root of the XSL-FO document or immediately after its start.

If I have in the template:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:tei="http://www.tei-c.org/ns/1.0" version="2.0">
    <xsl:template match="/">
        <fo:root>
        <?xep-pdf-page-layout two-columns-right?>

It simply returns:

<fo:root xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>

I’ve tried to touch preserving of processing instructions with: declare option exist:serialize "method=xhtml media-type=text/xml process-xsl-pi=yes"; in the prolog of my query but to no avail.

UPDATE I

The steps of my scenario are:

  1. loading the document from the DB
  2. passing it to the transform:transform() function
  3. whilst calling the transform:transform() function, I pass to it one basic stylesheet, which includes other stylesheets
  4. I need to add the processing instruction to a stylesheet for pages-masters, which covers the root of the FO document later used by the rendering engine. This stylesheet is included (<xsl:include/>) into the basic one (gathering all the stylesheets) and passed to the function.
1

There are 1 answers

2
Martin Honnen On BEST ANSWER

With XSLT, to output a processing instruction use https://www.w3.org/TR/xslt/#creating-processing-instructions, that is <xsl:processing-instruction name="xep-pdf-page-layout">two-columns-right</xsl:processing-instruction> to have the pi <?xep-pdf-page-layout two-columns-right?> in the transformation result.