On Thu, 12 Jul 2001, [EMAIL PROTECTED] wrote:
> >"DOM006 Hierarchy request error"
> 
> That means you're trying to insert a node someplace that the DOM spec says
> it doesn't belong -- eg, trying to insert a second root element, or trying
> to make an element the child of a text node. Check and fix your application
> code.
> 
> >Xalan-FAQ where I found a sentence saying not to use
> >"DOMImplementation.createDocument()"
> 
> Uhm... Could you tell me where that statement appears? Either you misread
> it and missed some contextual information, or it's misphrased...

http://xml.apache.org/xalan-j/faq.html#faq-7

Maybe I really misread it. I tried it again with
"DOMImplementation.createDocument()" and then added the children not to the
document itself but to an element I got with "Document.getDocumentElement()". 
But the effect is that I get en error, saying the attribute "version" of the
element "stylesheet" would not be allowed. After it, he complains about the
absence of the "version"-attribute. Do I have to tell him something about the
xsl-Syntax (like naming a dtd) or can I do something for not needing to name
such a document-definition?

My code looks now like: 
  private static final String NAMESPACE =
      "http://www.w3.org/1999/XSL/Transform";; 
  ...
  DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();  
  dFactory.setNamespaceAware( true ); 
  DocumentBuilder dBuilder =
  dFactory.newDocumentBuilder(); 
  DOMImplementation domImpl = dBuilder.getDOMImplementation(); 
  xslDoc = domImpl.createDocument( NAMESPACE, "xsl:stylesheet", null ); 
  tempElement = xslDoc.getDocumentElement(); 
  tempElement.setAttribute( "xmlns:xsl", 
      "http://www.w3.org/1999/XSL/Transform"; ); 
I then generate a subtree and apends it to tempElement. Then
  DOMSource xslDomSource = new DOMSource( xslDoc );
  Transformer transformer = tFactory.newTransformer(xslDomSource); 

=> Line 0; Column 0; Exception in thread "main"
javax.xml.transform.TransformerConfigurationException: "version" attribute is
not allowed on the xsl:stylesheet element! 

Reply via email to