Page 1 of 1

XSLT Transformation Scenario - Configure Parameters - "Evaluate XPath' - namespace problem

Posted: Thu Oct 04, 2018 6:46 pm
by Oleksii
Context:
XSLT Transformation Scenario, Configure Parameters Box

Problem: While trying to pass a value (//mei:note) and evaluate it is as an XPath I get the following error:
Cannot evaluate the XPath expression 'mei:note' for parameter 'Xpath'. Reason: Namespace prefix 'mei' has not been declared
The namespace 'mei:' ist declared both in xml and xslt so where I should declare it additionaly?

Re: XSLT Transformation Scenario - Configure Parameters - "Evaluate XPath' - namespace problem

Posted: Fri Oct 05, 2018 9:03 am
by Radu
Hi Alex,

From what I've looked at how we implement the "Evaluate as XPath" checkbox Oxygen tries to evaluate the XPath before the transformation but does not seem to evaluate it in the context of the XML document so it can only evaluate static XPaths (like for example '1+1') which do not depend on the XML nodes. I'll add an issue on our side to figure out how to make this work better.
As a possible workaround, uncheck the "Evaluate as XPath" checkbox and as value of the parameter use:

Code: Select all

${xpath_eval(//mei:note)}
Or pass the value as a plain string and then evaluate it inside the XSLT stylesheet using the saxon:evaluate extension function or if you are using XSLT 3.0 the xsl:evaluate element.

Regards,
Radu