DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13145>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13145

stylesheet requires attribute: version





------- Additional Comments From [EMAIL PROTECTED]  2002-09-30 18:57 -------
I looked at the comments in bug 648;In my code I have a reference to a path 
which points at the XSL file I am using;towards the last part of the comments 
in bug 648, it is suggested that name space elments accordingly to the 
following code snippet:


    javax.xml.parsers.DocumentBuilderFactory  df  = 
javax.xml.parsers.DocumentBuilderFactory.newInstance();
    df.setNamespaceAware(true);
    javax.xml.parsers.DocumentBuilder         db  = df.newDocumentBuilder();
logs("DocumentBuilder.isNamespaceAware()="+db.isNamespaceAware());
    org.w3c.dom.Document                      doc = db.newDocument();

    org.w3c.dom.Element element_1 = doc.createElementNS 
("http://www.w3.org/1999/XSL/Transform";, 
                                            "xsl:stylesheet");
    doc.appendChild(element_1);
    element_1.setAttribute("xmlns:xsl","http://www.w3.org/1999/XSL/Transform";);
    element_1.setAttribute("version","1.0");

    org.w3c.dom.Element element_2 = doc.createElementNS 
("http://www.w3.org/1999/XSL/Transform";, "xsl:template");
    element_1.appendChild(element_2);
    element_2.setAttribute("match","/");

Where do you parse the xsl file like
db.parse("flights.xsl") as it was mentioned earlier in comments.

Here is the code I use to transform. I have incorporated some of the 
suggestions given against #648:

           javax.xml.parsers.DocumentBuilderFactory df = 
javax.xml.parsers.DocumentBuilderFactory.newInstance();
           df.setNamespaceAware(true);
           javax.xml.parsers.DocumentBuilder db = df.newDocumentBuilder();
           Document xsldoc = db.parse(xsl); //the xsl points to the xsl file on 
the disk

        TransformerFactory  transFactory =  TransformerFactory.newInstance();
        Transformer transformer = transFactory.newTransformer(new DOMSource
(xsldoc));
        transformer.transform(new DOMSource(doc),new StreamResult(writer));

The line where I instantiate new Transformer throws the exception.

Reply via email to