You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by amitdk <am...@yahoo.com> on 2007/10/30 05:03:34 UTC

Re: How can I pass a node as parameter to translets for XSLTC-Processor

Return DTMAxisIterator instead of XNodeSet. That should help solve the issue.
Here's the method I use to convert a Document object and pass it as a
parameter to the translet.

    private DTMAxisIterator convertDocumentToNodeSet(Document document)
throws TransformerException
    {
        
        DOMSource domSource = new DOMSource(document);
        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);
        
        return iter;
    }
-- 
View this message in context: http://www.nabble.com/How-can-I-pass-a-node-as-parameter-to-translets-for-XSLTC-Processor-tf3121689.html#a13482151
Sent from the Xalan - J - Users mailing list archive at Nabble.com.


Re: How can I pass a node as parameter to translets for XSLTC-Processor

Posted by EddyXSL <ed...@free.fr>.
Hi amitdk,

I tried to use your solution to pass a node-set to a translet and I don't
understand why, it does not work.
It's very strange but when I navigate in the node-set parameter, I get the
nodes of the XML source tree instead ! When I use a debugger, the
DTMAxisIterator passed as parameter seems ok, it contains in some deep
fields the content of the XML fragment I want to pass as parameter.
But I have to admit that understand how DTMxxx classes work is a real
nightmare for me.

Anyway, I don't understand why the official answer to this node-set
parameter passing problem is "known issue for XSLTC". When we have a look at
the BasisLibrary Xalan class, we can see that the referenceToNodeSet method
(called when a parameter is a node-set) exists and does some stuff to get a
DTMAxisIterator from either a org.apache.xalan.xsltc.runtime.Node (really
don't understand how to get this kind of object) or a DTMAxisIterator by
cloning it.
That means for me that the feature is available, am I wrong ?

Thanks for your help,

Eddy


amitdk wrote:
> 
> Return DTMAxisIterator instead of XNodeSet. That should help solve the
> issue. Here's the method I use to convert a Document object and pass it as
> a parameter to the translet.
> 
>     private DTMAxisIterator convertDocumentToNodeSet(Document document)
> throws TransformerException
>     {
>         
>         DOMSource domSource = new DOMSource(document);
>         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);
>         
>         return iter;
>     }
> 

-- 
View this message in context: http://old.nabble.com/How-can-I-pass-a-node-as-parameter-to-translets-for-XSLTC-Processor-tp8649149p26160041.html
Sent from the Xalan - J - Users mailing list archive at Nabble.com.