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

Here should go questions about transforming XML with XSLT and FOP.
Oleksii
Posts: 40
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

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

Post by Oleksii » Thu Oct 04, 2018 6:46 pm

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?

Radu
Posts: 6436
Joined: Fri Jul 09, 2004 5:18 pm

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

Post by Radu » Fri Oct 05, 2018 9:03 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply