Helen,

I think you need the xsl:template node to be a child node of the root node of the stylesheet for the XSLT engine to parse this document correctly.  For example:


    xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="/" mode="ffp">
             <fo: .....
    <xsl:template>
</xsl:stylesheet>

Then you can do your FO inside the template or call a template that will generate the necessary FO output.  This is generally a good idea for FO that you will reference many times in your stylesheet (e.g. the master-reference for different pages or documents from one stylesheet).
hth,
Julian


----- Original Message ----
From: helen_166 <helen_166@hotmail.com>
To: www-xsl-fo@w3.org
Sent: Friday, February 23, 2007 11:30:43 AM
Subject: xml to xslfo using xslt doesnt work?


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");
    }


--
View this message in context: http://www.nabble.com/xml-to-xslfo-using-xslt-doesnt-work--tf3279766.html#a9121929
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.






Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.