[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Errors when trying to use Xalan instead of Saxon

Subject: RE: Errors when trying to use Xalan instead of Saxon
From: "Jason Silva" <jason.silva@xxxxxxxxxxx>
Date: Wed, 24 Jul 2002 09:56:08 -0400
jason silva
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.