Java code that works without calling the saxon:parse function
Code:
String mystring = System.setProperty("javax.xml.transform.TransformerFactory", "com.saxonica.config.ProfessionalTransformerFactory");
// Create a transform factory instance.
TransformerFactory tfactory1 = TransformerFactory.newInstance();
File xsl1 = new File("E:\\apache-tomcat-6.0.20\\webapps\\orbeon\\xforms-jsp\\Andy\\pdfs\\temp.xsl");
Source xsltSrc1 = new StreamSource(xsl1);
Transformer transformer1 = tfactory1.newTransformer(xsltSrc1);
File file1 = new File("E:\\apache-tomcat-6.0.20\\webapps\\orbeon\\xforms-jsp\\Andy\\pdfs\\temp.fo");
FileOutputStream myFileOutputStream1 = new FileOutputStream(file1);
Source src1 = new StreamSource("E:\\apache-tomcat-6.0.20\\webapps\\orbeon\\xforms-jsp\\Andy\\pdfs\\temp.xml");
StreamResult res1 = new StreamResult(myFileOutputStream1);
transformer1.transform(src1,res1) ;
The xsl code below, note it calls saxon:parse at the bottom of the file.
Code:
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:xalan="http://xml.apache.org/xalan"
exclude-result-prefixes="xalan" xmlns:exsl="http://exslt.org/common" xmlns:saxon="saxon.sf.net"
extension-element-prefixes="exsl saxon">
<!--
<xsl:value-of select="system-property('xsl:vendor')"/>
-->
<xsl:variable name="rootstart" select="concat('<root','>')"></xsl:variable>
<xsl:variable name="rootend" select="concat('</root','>')"></xsl:variable>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="temp"
margin-top="25pt" margin-bottom="25pt"
page-width="11in" page-height="8.5in"
margin-left="25pt" margin-right="25pt">
<fo:region-body margin-bottom="50pt" margin-top="100pt"/>
<fo:region-before extent="100pt" />
<fo:region-after extent="25pt" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="temp">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="18pt" color="navy">
<fo:inline></fo:inline>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="left" font-size="8pt">
<fo:inline padding-left="75%">
Page <fo:page-number />
</fo:inline>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:choose>
<xsl:when test="data/formtype = 'Product Liability/Completed Operations Coverage'">
<fo:block font-weight="bold">
<fo:block line-height="15mm" font-size="22pt"><xsl:value-of select="data/formtype"/></fo:block>
<fo:table>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="10mm"/>
<fo:table-column column-width="120mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell><fo:block font-size="18pt">I.</fo:block></fo:table-cell>
<fo:table-cell number-columns-spanned="2" font-size="18pt"><fo:block>Description</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Acceptable </fo:block></fo:table-cell>
<fo:table-cell><fo:block>Comments/Recs</fo:block></fo:table-cell>
<fo:table-cell><fo:block>N/A</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell><fo:block>a.</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Who Are Products Sold To?</fo:block></fo:table-cell>
<fo:table-cell number-columns-spanned="3"><fo:block ><xsl:value-of select="data/description/who"/></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell><fo:block>b.</fo:block></fo:table-cell>
<fo:table-cell ><fo:block>Describe the Product(s):</fo:block></fo:table-cell>
<fo:table-cell number-columns-spanned="3"><fo:block ><xsl:value-of select="data/description/decribe"/></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell><fo:block>c.</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Any Private Labelling?</fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/private = 1">Yes</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/private = 0">No</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/private = 2">N/A</xsl:if></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell><fo:block>d.</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Does Ins'd Manufacture the Product?</fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/manufacture = 1">Yes</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/manufacture = 0">No</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/manufacture = 2">N/A</xsl:if></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell><fo:block>e.</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Are there Any Aircraft or Military Applications?</fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/aircraft = 1">Yes</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/aircraft = 0">No</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/aircraft = 2">N/A</xsl:if></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell><fo:block>f.</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Any Vehicle Steering or Brake Parts?</fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/brake = 1">Yes</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/brake = 0">No</xsl:if></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:if test="data/description/brake = 2">N/A</xsl:if></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell number-columns-spanned="5"><fo:block>Comments:</fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
<fo:table-cell number-columns-spanned="5">
<fo:block>
<xsl:apply-templates select="saxon:parse(concat($rootstart,data/description/comments,$rootend))"></xsl:apply-templates>
<xsl:value-of select="system-property('xsl:vendor')"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="br">
<fo:block line-height="10mm"></fo:block>
</xsl:template>
<xsl:template match="text()">
<xsl:copy></xsl:copy>
</xsl:template>
</xsl:stylesheet>
Now I am running xforms on the front end and this sends the xml to the back end and it gets sucked in to the transform above. I have added the saxon9pe.jar to the lib directory of the Orbeon web application which runs under tomcat.
Regards