[xslt] Proposed enhancement to some libxslt-0.6.0 routines



We have encountered a few problems with the current library.
 
1) apply-template with parameter is not correct
The problem occurs in transform.c.  When xsltApplyTemplates calls xsltProcessOneNode, that routine clears variables (including parameters) before calling xsltApplyOneTemplate.  Furthermore, if xsltDefaultProcessOneNode is called, the same problem occurs.  Our proposed solution is to remove this clearing of variables (since it is done by xsltApplyTemplates before calling xsltProcessOneNode).
 
2) there are major problems with the position() and last() functions
There are two sub-problems involved.  First, when processing of the stylesheet first begins, a call is made to xmlXPathNewContext.  That routine initializes the two variables proximityPosition and contextSize to be "illegal" values (-1) which (we suppose) is okay for the general case, but not okay for xslt (where the initial "position" should never be undefined).  The result of this problem is  "crash", for example, if position() is used on a global variable.  Our proposed solution is to set the two variables to zero after the call within xsltNewTransformContext.
The second sub-problem concerns the handling of these same two variables, proximityPosition and contextSize, within the remaining code.  We found that they were being "corrupted" at numerous points throughout the code and, after some further investigation, determined that this was happening within the routine xmlXPathCompiledEval.  Our proposed solution is to insert code to save and restore them each time this routine is called - it may be better to change the xml routine, but we would rather avoid going into the xml library at this point.
 
3) the "base" path of the document() function should be interpreted relative to the URI of the stylesheet
If our interpretation of the spec is correct, a small enhancement to functions.c fixes this problem.
 
I have attached the patches we have made to solve all of the above points, and would appreciate your consideration of them.  Note that these patches  change the results of some of the docbook tests, but we believe that the changed results are more correct (but not yet totally correct .....).
 
 
Bill Brack
ABC QuickSilver

Attachment: libxslt-0.6.0_patch1
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]