开发者

Dynamic Assign in BPEL 2.0

开发者 https://www.devze.com 2023-03-02 23:16 出处:网络
Is it possible to dynamically generate an assign xpath from a variable and an XPath string. ie. <assign name=\"dynamicAssign\">

Is it possible to dynamically generate an assign xpath from a variable and an XPath string.

ie.

<assign name="dynamicAssign">
    <copy>
开发者_如何学Python        <from>$VariablePayload/$xpath_into_variable_payload</from>
        <to>...</to>
     </copy>
</assign>


No, it is not possible to feed in an XPath expression from a variable. What you could do instead is to rewrite your XPath in order to select elements whose names come from other variables. This however is still a quite static approach. To achieve this, you can use an XPath predicate together with the name() or local-name() function.

e.g.:

<assign name="dynamicAssign">
   <copy>
       <from>$VariablePayload/*[local-name() = $firstElementName]</from>
       <to>...</to>
    </copy>
 </assign>


If you want it to be truly dynamic you'd have to write an eval function. This would be platform and language specific as I'm sure each platform has their own API for defining custom xpath functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消