© Copyright IBM Corp. 2011. All rights reserved. 233
Appendix A. Supporting content
The content shared in this appendix supports the implementation of the
WCToMediationModule mediation module.
The WESB WCToMediationModule mediation module uses a custom stylesheet
to mediate the message in OrderProcess operation. This stylesheet is named
ProcessOrderToCreateOrderInput.xsl (Example A-1).
Example A-1 ProcessOrderToCreateOrderInput.xsl
<?xml version="1.0" encoding="UTF-8"?>
<!--
=================================================================
xslt/ProcessOrderToCreateOrderInput.map
=================================================================
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation"
xmlns:_ord="http://www.ibm.com/xmlns/prod/commerce/9/order"
xmlns="http://www.sterlingcommerce.com/documentation/YFS/createOrder/in
put"
A
234 Selling and Fulfillment Solutions Using WebSphere Commerce and IBM Sterling Order
exclude-result-prefixes="xalan _wcf _ord"
version="1.0">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"
indent="no" />
<xsl:strip-space elements="*" />
<xsl:template name="ProcessOrderToOrder">
<xsl:param name="ProcessOrder" />
<xsl:variable name="order"
select="$ProcessOrder/_ord:DataArea/_ord:Order" />
<Order>
<xsl:attribute name="OrderNo">
<xsl:text>WC_</xsl:text><xsl:value-of
select="$order/_ord:OrderIdentifier/_wcf:UniqueID" />
</xsl:attribute>
<xsl:attribute name="OrderDate">
<xsl:value-of select="$order/_ord:PlacedDate" />
</xsl:attribute>
<OrderLines>
<xsl:for-each select="$order/_ord:OrderItem">
<OrderLine>
<xsl:choose>
<xsl:when test="contains('-',
_ord:OrderItemIdentifier/_wcf:UniqueID)">
<xsl:attribute name="PrimeLineNo">
<xsl:value-of
select="substring-before(_ord:OrderItemIdentifier/_wcf:UniqueID,'-')"
/>
</xsl:attribute>
<xsl:attribute name="SubLineNo">
<xsl:value-of
select="substring-after(_ord:OrderItemIdentifier/_wcf:UniqueID, '-')"
/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="PrimeLineNo">
<xsl:value-of
select="_ord:OrderItemIdentifier/_wcf:UniqueID" />
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
Appendix A. Supporting content 235
<xsl:attribute name="OrderedQty">
<xsl:value-of select="_ord:Quantity" />
</xsl:attribute>
<xsl:attribute name="FillQuantity">
<xsl:value-of select="_ord:Quantity" />
</xsl:attribute>
<xsl:attribute name="CarrierServiceCode">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingMode/_ord:ShippingModeI
dentifier/_ord:ExternalIdentifier/_ord:ShipModeCode" />
</xsl:attribute>
<xsl:attribute name="ShipNode">
<xsl:value-of
select="_ord:FulfillmentCenter/_ord:FulfillmentCenterIdentifier/_wcf:Na
me" />
</xsl:attribute>
<xsl:attribute name="ReqShipDate">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:RequestedShipDate" />
</xsl:attribute>
<xsl:choose>
<xsl:when
test="_ord:OrderItemShippingInfo/_ord:ShippingMode/_ord:ShippingModeIde
ntifier/_ord:ExternalIdentifier/_ord:ShipModeCode = 'PickupInStore'">
<xsl:attribute
name="DeliveryMethod">PICK</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name="DeliveryMethod">SHP</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<OrderLineReservations>
<OrderLineReservation>
<xsl:attribute name="ItemID">
<xsl:value-of
select="_ord:CatalogEntryIdentifier/_wcf:ExternalIdentifier/_wcf:PartNu
mber" />
</xsl:attribute>
<xsl:attribute name="Node">
236 Selling and Fulfillment Solutions Using WebSphere Commerce and IBM Sterling Order
<xsl:value-of
select="_ord:FulfillmentCenter/_ord:FulfillmentCenterIdentifier/_wcf:Na
me" />
</xsl:attribute>
<xsl:attribute name="ReservationID">
<xsl:text>WC_</xsl:text><xsl:value-of
select="$order/_ord:OrderIdentifier/_wcf:UniqueID" />
</xsl:attribute>
<xsl:attribute name="Quantity">
<xsl:value-of select="_ord:Quantity" />
</xsl:attribute>
</OrderLineReservation>
</OrderLineReservations>
<Item>
<xsl:attribute name="ItemID">
<xsl:value-of
select="_ord:CatalogEntryIdentifier/_wcf:ExternalIdentifier/_wcf:PartNu
mber" />
</xsl:attribute>
<xsl:attribute name="UnitOfMeasure">
<xsl:choose>
<xsl:when
test="_ord:Quantity/@uom='C62'">EACH</xsl:when>
<xsl:when test="_ord:Quantity/@uom">
<xsl:value-of select="_ord:Quantity/@uom"
/>
</xsl:when>
<xsl:otherwise>EACH</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</Item>
<PersonInfoShipTo>
<xsl:attribute name="FirstName">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:ContactNam
e/_wcf:FirstName" />
</xsl:attribute>
<xsl:attribute name="LastName">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:ContactNam
e/_wcf:LastName" />
</xsl:attribute>
<xsl:attribute name="AddressLine1">
Appendix A. Supporting content 237
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:AddressLine[1]" />
</xsl:attribute>
<xsl:attribute name="AddressLine2">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:AddressLine[2]" />
</xsl:attribute>
<xsl:attribute name="AddressLine3">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:AddressLine[3]" />
</xsl:attribute>
<xsl:attribute name="City">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:City" />
</xsl:attribute>
<xsl:attribute name="State">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:StateOrProvinceName" />
</xsl:attribute>
<xsl:attribute name="Country">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:Country" />
</xsl:attribute>
<xsl:attribute name="ZipCode">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:Address/_w
cf:PostalCode" />
</xsl:attribute>
<xsl:attribute name="EMailID">
<xsl:value-of
select="_ord:OrderItemShippingInfo/_ord:ShippingAddress/_wcf:EmailAddre
ss1/_wcf:Value" />
</xsl:attribute>
</PersonInfoShipTo>
<LinePriceInfo>
<xsl:attribute name="UnitPrice">
<xsl:value-of
select="_ord:OrderItemAmount/_wcf:UnitPrice/_wcf:Price" />
</xsl:attribute>

Get Selling and Fulfillment Solutions Using WebSphere Commerce and IBM Sterling Order Management now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.