Subject: RE: [xsl] Errors when trying to use Xalan instead of Saxon From: "Jason Silva" <jason.silva@xxxxxxxxxxx> Date: Wed, 24 Jul 2002 09:56:08 -0400 |
Thanks for the info Kumar, I tried a bunch of different variations but the problem lies in the conformity between Xerces and Crimson. You see, I am trying to have multiple stylesheets nested within one XSL file. I am using DOM, in particular the Node class to break up the file into chunks and then run the transformations in a loop. This worked fine with Crimson and Saxon but gives me an error with Xerces and Xalan. The problem lies when attempting to get a ByteStream from the myNode.toString() and then constructing a transform with this Stream. With Crimson the myNode.toString gives me a nice String containing the nested template. However with Xerces I get the root name and null. I have also tried instantiating the transformer with the Node itself but this doesn't work either. Below is what I have ... I think we run into diffuculty trying to have multiple stylesheets in one xsl file, but this should be do-able. Element root = transform.getDocumentElement(); if ( root.getTagName().equals("xsl:stylesheet") ) { Transformer transformer = TransformerFactory.newInstance().newTransformer(new DOMSource(root/*transform*/)); transformer.transform(new DOMSource(model), result); } else if ( root.getTagName().equals("pipeline") ) { NodeList l = root.getChildNodes(); for ( int i = 0, j = 1 ; i < l.getLength() ; i++ ) { Node n = l.item(i); if ( ! ( n instanceof Element ) ) continue; System.out.println("String: " + n.toString()); //Tried initializing with DOMSource(n) but that does not work either Transformer transformer = TransformerFactory.newInstance().newTransformer( new SAXSource(new InputSource (new ByteArrayInputStream(n.toString().getBytes())))); DOMResult domResult = new DOMResult(); transformer.transform(new DOMSource(model), domResult); model = (Document) domResult.getNode(); } // create an identity transform just to copy to the final result Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.transform(new DOMSource(model), result); } Sorry about the formatting. Any Suggestions would be much appreciated Thanks a bunch Jason Silva XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Errors when trying to use, KUMAR NINGASHETTY | Thread | RE: [xsl] Errors when trying to use, Michael Kay |
[xsl] calling javascript during tra, Dan Diebolt | Date | Re: [xsl] Acheiving ..2nd level gro, G. Ken Holman |
Month |