« Return to Thread: xml to xslfo using xslt doesnt work?

xml to xslfo using xslt doesnt work?

by helen_166 :: Rate this Message:

Reply to Author | View in Thread

i have a xml file which i need to transform to xslfo

i have created a java class to convert it but it doesnt convert correctly, when it converts the file the fo tags are completly removed which isnt what i want can anyone tell me what im doing wrong

my xslt: (part of)
<?xml version="1.0" encoding="iso-8859-1"?>
 
 
                <fo:root xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:saxon="http://icl.com/saxon">
                  <fo:layout-master-set>
                 
                 
                    <fo:simple-page-master master-name="my-page">
                      <fo:region-body margin="0.75in"/>
                    </fo:simple-page-master>
                  </fo:layout-master-set>
 
                  <fo:page-sequence master-reference="my-page">
                    <fo:flow flow-name="xsl-region-body">
                     
 
                     
                      <xsl:template match='/' mode='ffp'>
                     
                      </xsl:template>
                   
                    </fo:flow>
                  </fo:page-sequence>
                </fo:root>


the java class:
    public void CreateXSLFO(String xmldocname, String xsltdocname, String xslfodocname) {
       
        System.out.println("creating xsl-fo");
       
        File xmldocument = new File(xmldocname);
        File xsltdocument = new File(xsltdocname);
        File xslfodocument = new File(xslfodocname);      
       
        try {
            OutputStream outputstream = new java.io.FileOutputStream(xslfodocument);
       
            TransformerFactory factory = TransformerFactory.newInstance();
           
            //pass the xslt document
            Transformer transformer = factory.newTransformer(new StreamSource(xsltdocument));
       
            //pass the xml document
            Source sourse = new StreamSource(xmldocument);
           
            //pass the outputstream (new file)
            Result result = new StreamResult(outputstream);
 
            // transform the xslt to xsl-fo using FOP
            transformer.transform(sourse, result);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
       
        System.out.println("xslfo created");
    }

 « Return to Thread: xml to xslfo using xslt doesnt work?