Search code examples
javaxmlxsltapache-fop

xsl extensionFunctions returning fo string


How could i achive something like

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:test="java:Hello">
  <xsl:template match="/">
     <test:Hola getTransformationOf="."/>
  </xsl:template>

and my class Hello have a methode Hola returning a formated stream like

<fo:block>.......< /fo:block>

If i use <xsl:value-of select="test:MyMethode(.)"/> the stream <fo:block>.......</fo:block> will be presented as a string not as an FO instruction

PS: the transformation should be in a java class


Solution

  • I think you should be able to use xsl:copy-of ... as in:

    <xsl:copy-of select="test:MyMethode(.)"/>
    

    or possibly your "string" result is being escaped, so try:

    <xsl:value-of select="test:myMethode(.)" disable-output-escaping="yes"/>
    

    I have used both methods to return inline SVG into XSL FO to be interpreted as nodes and not a string. I think it really depends on what MyMethode() is returning as a data type.