"Great minds think alike", or so they say :>.
I'll pick this up and incorporate on the weekend if you have no objections?
I'd totally forgotten the ::intersect() method in the nodelist class. Makes the code nice and neat and the change very simple. The method was put in for XPath-Filter2 code, which is designed to handle small XPath expressions in sequence - basically doing what you are after I think?
With thanks!
Cheers, Berin
John Moore wrote:
I do my best thinking while driving home. Last night I thought that a possible solution that I could try is exactly what you suggest below. So, I had another look at the code today and tried the following code changes to TXFMXPath::evaluateExpr(...) which seems to work (on the limited test data that I am using).
The following code fragments come from TXFMXPath::evaluateExpr(...). My changes are commented with my initials JDM. I have left in just enough context for you to see where in TXFMXPath::evaluateExpr(...) I have added the code.
If you would care to look it over, I would appreciate.
As to your other comment "why dont I used a more complex XPath expression" - I probably will, but I am an "old" programer who tries to modularise things into small, easy-to-understand bits. I find long XPath expressions too taxing on the brain.
ta John
switch (inputType) {
case DOM_NODE_DOCUMENT :
case DOM_NODE_XPATH_NODESET : // Added by JDM. // do XPath over the whole document and, if the input was an XPath Nodeset, then
// later intersect the result with the input nodelist
cd = XalanDOMString("/"); // Root node cexpr = cd.c_str();
..... ..... .... .... ... ... .. .
for (int i = 0; i < size; ++ i) {
if (lst.item(i) == xd) m_XPathMap.addNode(document); else { item = xwn.mapNode(lst.item(i)); m_XPathMap.addNode(item); } }
// Start Insert by JDM
if (inputType == DOM_NODE_XPATH_NODESET)
{
//the input list was a XPATH nodeset, so we must intersect the results of the XPath
//processing done above with the input nodeset
m_XPathMap.intersect(input->getXPathNodeList());
}
// End Insert by JDM
xpesd.uninstallExternalFunctionGlobal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"));