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

RE: Saxon setParameter() of node-set problems

Subject: RE: Saxon setParameter() of node-set problems
From: Vasu Durgavarjhula <vasud@xxxxxxxxxxxxx>
Date: Fri, 23 Mar 2001 10:04:24 -0800
afzal khalfay
Get the document element using Document.getDocumentElement and then use this
Element to create your XNodeSet, after which you can set the parameter. I am
using this in XalanJ2.0 and it works fine for me.

-Vasu

> -----Original Message-----
> From: Shakeel Mahate [mailto:shakeelmahate@xxxxxxxxxxx]
> Sent: Friday, March 23, 2001 7:50 AM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Cc: Sihyung Park; Brian Graves; Yasir Rizwan; Syed Naqi; Sutanu Ghosh;
> Shakeel Mahate; Mohsin Khalil; Afzal Khalfay; 
> shakeelmahate@xxxxxxxxxxx
> Subject:  Saxon setParameter() of node-set problems
> 
> 
> I want to send a NodeSet to a Saxon transformer via the setParameter()
> function.
> 
> I have a org.w3c.dom.Document object in memory which I need 
> to send to the
> transformer before calling transform.
> 
> So, here's the problem, I have not been able to figure out 
> how to transform
> org.jdom.Document into a node set as required by Saxon transformer.
> 
> I know how to output an org.w3c.dom.Document from a org.jdom.Document
> 
> For Xalan, I have tried the following:
> 
> XNodeSet nodeSet = new XNodeSet(dom);
> transformer.setParameter("referenceXml", nodeSet);
> 
> but the xalan:evaluate or any XPath expr on the the parameter 
> referenceXml
> do not work.
> 
> I know the problem isnt with my XPath expressions because if 
> I set the value
> of the parameter, via
> <xsl:parameter name="referenceXml">
>   <xsl:value-of select="document('ref.xml')"/>
> </xsl:parameter>
> then all of my XPath expressions and xalan:evaluate(....) 
> work correctly
> 
> But now when I send the parameter value as shown above, none 
> of the XPath
> expressions evaluate.
> 
> I want to give up on Xalan and try Saxon 6.2.2, but I dont know how to
> convert the org.w3c.dom.Document into a node-set expression 
> or DocumentInfo
> as expected by
> Saxon.
> 
> I have tried the following
> 
> Builder treeBuilder = new TreeBuilder();
> DOMDriver driver = new DOMDriver();
> driver.setContentHandler(treeBuilder); // This line does not 
> compile, since
> treeBuilder is not a ContentHandler and I have not been able 
> to find an
> appropriate ContentHandler
> 
> Next I tried the following
> InputSource is = new InputSource("dummy");
> DOMDriver driver = new DOMDriver();
> driver.setStartNode(dom);
> is.setSystemId("dummy");
> driver.setSystemId("dummy");
> SAXSource saxSource = new SAXSource(driver, is);
> Builder treeBuilder = new TreeBuilder()
> DocumentInfo rootNode = treeBuilder.build(saxSource);
> .... code deleted...
> transformer.setParameter("referenceXML", rootNode);
> ......
> transformer.transform(streamSource, streamResult);
> 
> I get a NullPointerException
> at com.icl.saxon.ContentEmitter.getNameCode(ContentEmitter.java:128)
> at com.icl.saxon.ContentEmitter.startElement(ContentEmitter.java:118)
> at com.icl.saxon.DOMDriver.walkNode(DOMDriver.java:275)
> at com.icl.saxon.DOMDriver.parse(DOMDriver.java:191)
> at com.icl.saxon.DOMDriver.parse(DOMDriver.java:162)
> at com.icl.saxon.Builder.build(Builder.java:263)
> at test.TestXPath.main(TestXPath.java:103)
> 
> Mike, please help me.
> 
> -Shakeel
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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.