xsl-list
[Top] [All Lists]

RE: Transforming XML to XSL-FO by XSLT in java

2004-05-06 00:30:45
--- Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com wrote:
Xalan-J documentation has examples of this

<http://xml.apache.org/xalan-j/usagepatterns.html#basic>,
did you look at them?

Cheers,

Jarno - Rotersand: Electronic World Transmission
([:SITD:] reconstruction)


Hi Jarno,
   I wrote the code by using procedure given in above
site using java;

Java code follows;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.xml.transform.Transformer;
import
javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

public class xml2fo
{
        public static void main(String[] args){ 
  
        try{
                TransformerFactory tFactory =
TransformerFactory.newInstance();
        
                Transformer transformer =
tFactory.newTransformer(new
StreamSource("Furniture.xsl"));
        
                transformer.transform(new
StreamSource("Furniture.xml"), new StreamResult(new
FileOutputStream("Furniture.fo")));
        
                
           }
        catch(Exception e){
        
        }
  }
}

But it shows the error like this;
C:\xalan\samples\SimpleTransform>java xml2fo
[Error] Furniture.xsl:5:391: Document root element
"xsl:stylesheet", must mat
DOCTYPE root "xml".
[Error] Furniture.xsl:5:391: Element type
"xsl:stylesheet" must be declared.
[Error] Furniture.xsl:6:30: Element type "xsl:output"
must be declared.
[Error] Furniture.xsl:7:35: Element type
"xsl:variable" must be declared.

I am not able to find whether it is XSLT or Java
coding..

Regards
Arul


        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 


<Prev in Thread] Current Thread [Next in Thread>