You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Simon Bretin <si...@anyware-tech.com> on 2003/09/04 11:45:46 UTC

TRAX/XSLTC and Cocoon

Hello,

I have encountered a problem when using XSLTC and cocoon (2.0.3) via the 
TRAX API.

In some cases, the current node was not being re-set correctly after a 
call to the document() function. The result was that the XSL code being 
executed after the document() function call wasn't being executed on the 
correct XML.

Looking into the code, I found what I think is a problem in the 
org.apache.xalan.xsltc.dom.LoadDocument class. However since I don't 
know the code very much, the problem might in fact come from some place 
else ! Here is what I found anyway :
In the private static DTMAxisIterator document(String uri, String base, 
AbstractTranslet translet, DOM dom) function, at some point we ask for 
the DOMCache of the current translet. The creation of the DOM is then 
dependant of whether this cache is present or not. IF the cache is not 
present, then the code path executed works correctly. However when using 
Cocoon and the TRAX API the DOMCache is actually a 
org.apache.xalan.xsltc.trax.TransformerImpl. After resolving the source 
fiel, the call ends up in the getDOM() method of this class, and this is 
where I see some problems.
In that method, a new XSLTCDTMManager is always created, where as id the 
DOMCache wasn't present, the XSLTCDTMManager would be gotten from the 
currently executing translet, which is definitely the correct thing to 
do. I think this getDOM method needs to be aware of that fact and should 
be modified in consequence.

I solved this problem differently ... Not knowing the code enough, I had 
to take a shortcut ! I added a method in the DOMCache interface that 
returns the URIResolver. In the document() function I use this Resolver 
to get the Source object, and then I follow the same code path as one 
being executed when no DOMCache is present ... This turns out to solve 
the problems I was seeing.

Could somebody look into this problem, and give me some pointers on how 
this problem should be solved "correctly" ?  I'm willing to do this job, 
but I can't learn the whole XSLTC code base fast enough ;-)

Thanks for your help,

Simon.