If you're using the net.sf.saxon.sxpath.XPathEvaluator interface, try
 
((IndependentContext)xpathEvaluator.getStaticContext()).declareNamespace("", "my-default-namespace");
 
Michael Kay
http://www.saxonica.com/
 


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Mohana Ramaratnam
Sent: 28 August 2006 21:49
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Default Namespace XPath Expression Prefix

Hello,

 

I am using the Saxon 8-7-3j XPathAPI within a java application without XSLT and XQuery to resolve XPath expressions.

 

Does anyone know of any class/method (within Saxon or outside) which “prefixes” a xpath expression (string) with a given prefix (namespace) so that even if my document has the default namespace and the xpath expression is without a prefix, I can then use the StandardContext to declare the namespace and I get the desired xpath.

 

Thanks

-mr