Attached are ec_test.xml ec_test.xsl and ec_test.err. The point of them is to test use of variables in xpath expressions that will be dynamically evaluated (i.e. xpath expressions with variables from the source xml are evaluated dynamically by the stylesheet.) The variable $sibList is global in the stylesheet and selects a RTF from the source xml. There are then calls xalan:execute on string values in the source document that are XPath expressions containing $sibList. I have a few debugging messages in there because I wanted to see what was going on. The problem seems to be that dynamically evaluated xpath expressions aren't finding global variables.
Is this actually an error in Xalan-C++ (using 1.4) or am I misusing xalan:evaluate? The XPathExecutionContext seems to include variables (as there is a getVariable method), so it doesn't seem like it is that. Also, I assume that Xalan-C++ is trying to follow the conventions for EXSLT's dyn:evaluate I have searched bugzilla and the mailing list with no results. I have also tested this against Saxon (changing xalan namespace to saxon and using saxon:evaluate instead) and I get the expected result (i.e. it finds the variables correctly). But then my expected result might not be the correct result. :) I am going to try getting the latest 1.5 RC and see if the issue exists in it. Rachael
ec_test.err
Description: ec_test.err
<?xml version="1.0"?> <root> <xpath>exslt-common:object-type($sibList)</xpath> <xpath>string($sibList)</xpath> <sibling-list> <sibling>a</sibling> <sibling>b</sibling> </sibling-list> <kid id="a" xpath="$sibList/sibling[1]/text()"/> <kid id="b" xpath="$sibList/sibling[2]/text()"/> </root>
ec_test.xsl
Description: ec_test.xsl
