Purpose:
While reviewing one of implementation issue, I have observed a different behavior wrt XSLT
transformation.
Thought of sharing.
Issue:
The previous data of the XSLT target variable will be reset/cleared. The
target variable will be updated with the result of the Transformation.
Fix/workaround:
1. Use XSLT target variable also as one of its input variable.
2. Copy previous data from its own variable inside XSLT to target.
3. Assign the new data from other XSLT input variables as needed.
Implementation:
The below bpel has two transformations conditionally.
Else Block
DemoXsltTransformComposite/SOA/Transformations/UOM_Amount_status_date.xsl
If Block
DemoXsltTransformComposite/SOA/Transformations/UOM_Amount_Status_Date_2.xsl
Input:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:PurchaseOrder xmlns:ns1="http://xmlns.oracle.com/apps/scm/orderManagement/purchaseOrder/service/types"> <ns1:orderId>10</ns1:orderId> <ns1:orderedQty>10</ns1:orderedQty> <ns1:orderedUOM>EA</ns1:orderedUOM> <ns1:amount>100</ns1:amount> <ns1:status>XSLT</ns1:status> <ns1:orderedDate>2019-08-25</ns1:orderedDate> </ns1:PurchaseOrder> </soap:Body> </soap:Envelope> |
Else Block result:
OrderId, OrderedQty were missing as data cleared by default xslt transformation.
<PurchaseOrder
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:client="http://xmlns.oracle.com/DemoSOAApp/DemoXsltTransformComposite/OMProcess2"
xmlns:ns0="http://xmlns.oracle.com/apps/scm/orderManagement/purchaseOrder/service/types"
xmlns="http://xmlns.oracle.com/apps/scm/orderManagement/purchaseOrder/service/types"> <ns0:orderedUOM>EA</ns0:orderedUOM> <ns0:amount>100</ns0:amount> <ns0:status>XSLT</ns0:status> <ns0:orderedDate>2019-08-25</ns0:orderedDate> </PurchaseOrder> |
If Block result:
OrderId, OrderedQty were retained.
<PurchaseOrder xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:client="http://xmlns.oracle.com/DemoSOAApp/DemoXsltTransformComposite/OMProcess2" xmlns:ns0="http://xmlns.oracle.com/apps/scm/orderManagement/purchaseOrder/service/types" xmlns="http://xmlns.oracle.com/apps/scm/orderManagement/purchaseOrder/service/types"> <ns0:orderId>10</ns0:orderId> <ns0:orderedQty>10</ns0:orderedQty> <ns0:orderedUOM>EA</ns0:orderedUOM> <ns0:amount>100</ns0:amount> <ns0:status>XSLT</ns0:status> <ns0:orderedDate>2019-08-25</ns0:orderedDate> </PurchaseOrder> |
Please find the project here.