This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Saxon setParameter() of node-set problems
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Saxon setParameter() of node-set problems
- From: Vasu Durgavarjhula <vasud at ingenuity dot com>
- Date: Fri, 23 Mar 2001 10:04:24 -0800
- Cc: Sihyung Park <sihyung dot park at vroom dot net>, Brian Graves <brian dot graves at vroom dot net>, Yasir Rizwan <yasir dot rizwan at vroom dot net>, Syed Naqi <syed dot naqi at vroom dot net>, Sutanu Ghosh <sutanu dot ghosh at vroom dot net>, Shakeel Mahate <shakeel dot mahate at vroom dot net>, Mohsin Khalil <mohsin dot khalil at vroom dot net>, Afzal Khalfay <afzal dot khalfay at vroom dot net>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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@hotmail.com]
> Sent: Friday, March 23, 2001 7:50 AM
> To: XSL-List@lists.mulberrytech.com
> Cc: Sihyung Park; Brian Graves; Yasir Rizwan; Syed Naqi; Sutanu Ghosh;
> Shakeel Mahate; Mohsin Khalil; Afzal Khalfay;
> shakeelmahate@hotmail.com
> Subject: [xsl] 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