What function can be used in the stylesheet that is getting executed in DataPower for below requirement
Xpath is stored in xsl variable (ex <xsl:variable name="xpaction" select="'/Math/Operation/Action"/>)
now i want to evaluate the xpath " /Math/Operation/Action" using variable "xpaction".
what DP extension function can be used so that if incoming message
will return "Add"
Pinned topic Datapower XSLT Xpath function
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-03-22T20:16:45Z at 2012-03-22T20:16:45Z by SystemAdmin
swlinn 100000E7QE1348 Posts
Re: Datapower XSLT Xpath function2012-03-21T20:16:09ZThis is the accepted answer. This is the accepted answer.dyn:evaluate(string) where string is your xpath. It's documented in the extension guide. Don't forget to add the dyn namespace to your stylesheet. I've always been cautious about using evaluate as I'd thought there could be some performance concerns. Another approach to a dynamic xpath, if the xpath depth were the same, would be
/*[local-name() = $level1]/*[local-name() = $level2] ... etc
SteveUpdated on 2014-03-25T02:59:17Z at 2014-03-25T02:59:17Z by iron-man
HermannSW 2700006U544903 Posts
Re: Datapower XSLT Xpath function2012-03-22T01:23:07ZThis is the accepted answer. This is the accepted answer.
- swlinn 100000E7QE
As for all EXSLT extension functions the DataPower documentation is minimal.
Find specific documentation on exslt.org, especially:
Here you see dyn:evaluate() in action for your sample and the stylesheet dyn4.xsl:
$ echo "<Math><Operation><Action>Add</Action></Operation></Math>" | \ > coproc2 dyn4.xsl - http: //dp5-l3:2223; echo <result>Add</result> $ $ cat dyn4.xsl <xsl:stylesheet version= "1.0" xmlns:xsl= "http://www.w3.org/1999/XSL/Transform" xmlns:dyn= "http://exslt.org/dynamic" exclude-result-prefixes= "dyn" > <xsl:output omit-xml-declaration= "yes"/> <xsl:variable name= "xpaction" select= "'/Math/Operation/Action'"/> <xsl:template match= "/"> <result><xsl:value-of select= "dyn:evaluate($xpaction)"/></result> </xsl:template> </xsl:stylesheet> $