Dave,
Now I'm doing the following (though its not working. pls. let me know how to
proceed.):-
The SimpleXPathAPI is evaluating by doing:
XalanNode* const theContextNode =
theEvaluator.selectSingleNode(
theDOMSupport,
theDocument,
XalanDOMString(argv[2]).c_str(),
thePrefixResolver);
const XObjectPtr theResult(
theEvaluator.evaluate(
theDOMSupport,
theContextNode,
XalanDOMString(argv[3]).c_str(),
thePrefixResolver));
theResult->str() returns the string id('id1').
I have added the following:
string myStr;
xalanc::XalanVector<char> data1;
theResult->str().transcode(data1);
myStr.assign(data1.begin(), data1.end());
const XObjectPtr theResult1(
theEvaluator.evaluate(
theDOMSupport,
theContextNode,
XalanDOMString(myStr.c_str()).c_str(),
thePrefixResolver));
Here I'm passing the context node evaluated before along with the XPath
expression got from the last evaluation. theResult1->str() is returning blank
string here.
Could you please tell me the correct way to proceed ? It would be very much
helpful if you could provide some code snippet as I want to learn Xalan
programming fast.
Best Regards,
Indrajit
On Mon, 12 Feb 2007 David Bertoni wrote :
>Indrajit Bhattacharya wrote:
>>Hi Dave,
>>
>>1. I'm using VC7.1.3088 (.Net framework SP1) on Windows XP Professional.
>
>Then you shouldn't have any problem building the binaries if you follow the
>build instructions. I use VS .Net 2003 as my primary development platform.
>
>>
>>2. Here I did not put it correctly. (pls. forgive me as I'm quite new to XML,
>>Xalan and XPath).
>>
>>Pls. see the problem I'm into below:
>>
>>I have some XML like:
>><A>
>> <B>
>> <C1 id="id1">1</C1>
>> <C2 id="id2">2</C2>
>> </B>
>> <D id="id('id1')">3</D>
>></A>
>>
>>When I give XPath expression like : /A/D/@id , I need to get value 1. The
>>value 1 will be coming from the element C1 whose id is "id1".
>>Please let me know how I can do the same, and how I can get the desired value
>>using the sample applications with Xalan.
>
>The sample XPath applications that ship with Xalan-C would need to be modified
>to do something like this, although you could do it with a stylesheet and an
>extension function.
>
>>
>>Currently I'm getting the string output id('id1'). In fact I need to get
>>value 1 (this corresponds to the value of the element whose id is id1).
>
>Since you want to use an XPath expression to select an attribute with another
>value that should also be evaluated as an XPath expression, you
>just need to add another evaluation. It should be very straightforward to
>modify the SimpleXPathAPI sample to do that.
>
>Dave