Title: How to use Xpath from Xalan.

The document itself is a node. In your case the document is the context. Just pass the address to the document as context.

 

/ Erik

 

-----Original Message-----
From: Sami Islam [mailto:[EMAIL PROTECTED]
Sent: den 19 maj 2004 10:16
To: Xalan User List
Subject: How to use Xpath from Xalan.

 

Hello,
I need some clarification on how to correctly use the XPathEvaluator in Xalan.

In the sample programs from Xalan 1.7 the evaluator is first used :
1) to find the context node.
2) to find the list of nodes.
3) finally evaluate the result.

My questions:
1) Do I have to get a context node?
e.g. If I want the node at /doc/[EMAIL PROTECTED]'Tom']/@last do I have to first get the context node for "/" and then evaluate the _expression_ "doc/[EMAIL PROTECTED]'Tom']/@last?

Isn't there a way I can just obtain the node directly without the 1) step.
e.g. evaluator.selectSingleNode(..., ...,  XalanDOMString("/doc/[EMAIL PROTECTED]'tom')/@last").c_str( ), ...); instead of evaluator.selectSingleNode(..., ...,  XalanDOMString("/").c_str( ), ...); first.

The only thing that is unclear to me is the evaluator.evaluate( ) member function that takes a "context_node" as its second parameter and "XpathString" as its third. 

Regards,
Sami

Reply via email to