Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

WSO2 BPS extends the default XPath coverage provided by the WS-BPEL specification, mostly by adding support for XPath 2.0 and offering a few utility extension functions to make some assignments easier. To use XPath 2.0 in processes, use the "queryLanguage" and "expressionLanguage' attributes as shown in the example below.

queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"

To make the XPath 2.0 default for the process, add these attributes to the root process element. If you want to stick with XPath 1.0 but want XPath 2.0 support for a specific assignment, you can also define these attributes on an assign element.

...

Allows to insert one or more siblings (specified by the $siblings argument in the signature below) before the first node of children (specified by the $children argument), all of whose nodes must have the same parent (specified by the $context argument).

ode:insert-before($contextas node(),$childrenas node()*,$siblingsas node()*)as node()

By design, this function is non-updating in that it preserves the identity and properties of its arguments (i.e., they don't try to change the XML in-place). Instead, a modified copy of the context node is created, essentially giving it a new identity. Further, it returns a single R-value item, as opposed to a sequence.

...

For those familiar with the XQuery Update Facility (http://www.w3.org/TR/2008/CR-xquery-update-10-20080801), the above example is semantically equivalent to the expression shown below:

insert nodes $siblings before $parent/child::node[position()=last()]

insert-after

Allows to insert one or more siblings (specified by the $siblings argument in the signature below) after the last node of children (specified by the $children argument), all of whose nodes must have the same parent (specified by the $context argument).

ode:insert-after($contextas node(),$childrenas node()*,$siblingsas node()*)as node()

By design, this function is non-updating in that it preserves the identity and properties of its arguments (i.e., they don't try to change the XML in-place). Instead, a modified copy of the context node is created, essentially giving it a new identity. Further, it returns a single R-value item, as opposed to a sequence.

...

For those familiar with the XQuery Update Facility (http://www.w3.org/TR/2008/CR-xquery-update-10-20080801), the above example is semantically equivalent to the expression shown below:

insert nodes $siblings after $parent/child::node()

insert-as-first-into

This is a function that allows you to insert the node(s) (specified by the $children argument in the signature below) as the first child(ren) of a given context node (specified by the $context argument).

ode:insert-as-first-into($contextas node(),$childrenas node()*)as node()

By design, this function is non-updating in that it preserves the identity and properties of its arguments (i.e., they don't try to change the XML in-place). Instead, a modified copy of the context node is created, essentially giving it a new identity. Further, it returns a single R-value item, as opposed to a sequence.

...

For those familiar with the XQuery Update Facility (http://www.w3.org/TR/2008/CR-xquery-update-10-20080801), the above example is semantically equivalent to the expression shown below:

insert nodes $childrenas first into $parent

insert-as-last-into

This is a function that allows you to insert the node(s) (specified by the $children argument in the signature below) as the last child(ren) of a given context node (specified by the $context argument).

ode:insert-as-last-into($contextas node(),$childrenas node()*)as node()

By design, this function is non-updating in that it preserves the identity and properties of its arguments (i.e., they don't try to change the XML in-place). Instead, a modified copy of the context node is created, essentially giving it a new identity. Further, it returns a single R-value item, as opposed to a sequence.

...

For those familiar with the XQuery Update Facility (http://www.w3.org/TR/2008/CR-xquery-update-10-20080801), the above example is semantically equivalent to the expression shown below:

insert nodes $childrenas last into $parent

delete

This is a function that allows you to delete one or more node(s) (specified by the $children argument in the signature below) from its parent (specified by the $context argument).

ode:delete($contextas node(),$childrenas node()*)as node()

By design, this function is non-updating in that it preserves the identity and properties of its arguments (i.e., they don't try to change the XML in-place). Instead, a modified copy of the context node is created, essentially giving it a new identity. Further, it returns a single R-value item, as opposed to a sequence.

...

For those familiar with the XQuery Update Facility (http://www.w3.org/TR/2008/CR-xquery-update-10-20080801), the above example is semantically equivalent to the expression shown below:

delete nodes $children

rename

This is a function that allows you to rename the context node (specified by the $context argument in the signature below) as per the given name (specified by $item, which is either a QName, Element or String).

ode:rename($contextas node(),$nameas item())as node()

By design, this function is non-updating in that it preserves the identity and properties of its arguments (i.e., they don't try to change the XML in-place). Instead, a modified copy of the context node is created, essentially giving it a new identity. Further, it returns a single R-value item, as opposed to a sequence.

...

For those familiar with the XQuery Update Facility (http://www.w3.org/TR/2008/CR-xquery-update-10-20080801), the above example is semantically equivalent to the expression shown below:

rename$personas fn:QName("http://www.example.com/example","manager")

Assign Assumption

WS-BPEL requires that for a copy operation to be valid, the data referred to by the from-spec and the to-spec MUST be of compatible types. Therefore, make sure that when you rename an element, the new name refers to a type that is compatible with the target variable. In other words, it should be of a substitutable (essentially stronger) complex type.

...

Alternatively this function can take a fourth parameter that would be the namespace of the elements used to wrap the split strings:

ode:split-to-elements(stringToSplit, separator, targetElement, targetNamespace)
Info
titleNote

This function was formerly known as splitToElements, which can still be used, but is deprecated.

...

This is a function that serialises a DOM node (specified by the $node argument in the signature below) into a string.

ode:dom-to-string($nodeas node())as xs:string           

process-property

<To be added>

This is a function that allows you to retrieve the value of a property defined in deploy.xml for the current process, with the given name (specified by the $name argument in the signature below, which is either a QName, String, Element or Single-Valued List).

ode:process-property($nameas item())as node()

Basically, this method gives you a way to reference properties, defined in deploy.xml for a given process, directly in the BPEL code for that process. The $name argument refers to any schema item that resolves to a QName. The return value is the child node of the property element with the given name.

...