InoReplaceChild function

hi!
My problem is replace nodes of a document using XPath functions which are defined into Tamino XQuery.
For example, this document:


value 1


value 2


value 3



and I want to replace the “C” element which parent is the last “B” element.
If I use:
lpNewNode = LoadXml(" new value “)
InoReplaceChild(”/A/@2", “A/B[3]/C”, lpNewNode);

it works well, but if I use:
lpNewNode = LoadXml(" new value “)
InoReplaceChild(”/A/@2", “A/B[last()]/C”, lpNewNode);
it doesn’t, and not error code is available.

why cannot I use “last()” function into ActiveX ?

[This message was edited by Josep on 22 Jan 2003 at 17:17.]

Is the syntax “A/B[last()]/C” correct?

Shouldn’t it be “A/B[position()=last()]/C”

Which version of Tamino are you running and which version of the MSXML are you using?


Stuart Fyffe-Collins
Software AG (UK) Ltd.

I think tha “A/B[last()/C” is correct, in any case, I test "A/B[position() = last()]/C and its the same problem.

Tamino Version is 3.1.1.4 an MSXML 3.0.

Thanks.

NodeLevelUpdate uses MSXML. Essentially it uses selectNodes() with the 2nd parameter that you pass to the InoReplaceChild() method.

Unfortunately the last() function within the XPath syntax was not supported with MSXML3.0 but was introduced with MSXML4.0 (recommended is MSXML 4.0SP1).

However for MSXML4.0SP1 to work with NodeLevelUpdate you need to upgrade Tamino to at least v3.1.2.1.


Stuart Fyffe-Collins
Software AG (UK) Ltd.