[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-j-users
Subject:    AW: How can I pass a node as parameter to translets for XSLTC-Processor
From:       "Ulrich Heeger" <heeger () dvberatung ! com>
Date:       2007-01-29 13:20:43
Message-ID: LFEEKBPJNEAJPBNHDKJKGEKICCAA.heeger () dvberatung ! com
[Download RAW message or body]


Hi Henry,
thank you very much for your help.

> One workaround would be to use the document function inside your
> stylesheet with a URI of your choosing.  Then install a URIResolver on the
> Transformer.  The URIResolver.resolve method should be implemented to look
> for that URI and return a DOMSource like the one you've described above.


We wouldn't like to change our stylesheets because we have so many developed
previously and we would have to change them for all our customers.
I read the article at
> https://issues.apache.org/jira/browse/XALANJ-2057

Is there any possibility to wrap a DOMSource in another object so I can pass
it as node-set as Parameter?
I have tried to adapt the code at this page to our requirements:

  DOMSource domSource = new DOMSource(node);
  XSLTCDTMManager mgr = new XSLTCDTMManager();
  DTM dtm = mgr.getDTM(domSource, false, null, true, true);
  int dtmRoot = dtm.getDocument();
  DTMAxisIterator iter = dtm.getAxisIterator(Axis.SELF);
  iter.setStartNode(dtmRoot);
  DTMIterator iterator = new OneStepIterator(iter, Axis.SELF);
  iterator.setRoot(dtmRoot, new XPathContext());
  XNodeSet xNodeSet =  new XNodeSet(iterator);
  transformer.setParameter("Node", xNodeSet);

I couldn't test this because I always get a NullPointerException:

   java.lang.NullPointerException
	at
org.apache.xpath.axes.ChildTestIterator.setRoot(ChildTestIterator.java:125)
	at org.apache.xpath.axes.OneStepIterator.setRoot(OneStepIterator.java:92)

So, I don't know if I have misunderstood you or might this be the right way?

Thanks a lot in advance,
Ulrich Heeger




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic