
Hi, previously, I wrote:
rather handle the lookup "manually"? That would require copying the document twice before the XSLT compilation, to use one copy for compilation and to store the other one. The doc loader would then return a copy of the second copy when the stylesheet URL is requested.
I revised my previous opinion on this. The current code now uses exactly this approach. Storing the string or a filename reference would not have solved the problem as there is nothing that keeps a user from building stylesheets by hand using the API. Alternatively, we could serialize the XSL to a string before compiling it and parse it on request. Daniel suggested that this might even be faster than deep-copying. I wouldn't mind hearing other opinions on this. Anyway, this is how it works now. Stylesheets that were parsed from strings are now special cased and a fake URI is generated for them. The lookup works as follows (first match wins): 1) if the requested URI is a fake URI a) the default resolver is asked to find the document b) the URI is checked against the current XSL document 2) the Python resolvers are called 3) the default resolver is called 4) fail This allows document('') to work in all cases (cross-fingers) and prefers the Python resolvers for anything but string-loaded stylesheets. I think that's a good trade-off. Doctests and explanations can be found in doc/resolvers.txt. Remember: The more feedback I get, the faster the branch can be merged into the trunk. If anyone can come up with additional doctests, clarifications or unit test cases, that would be much appreciated. Stefan