<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">

    <!-- Imports -->
    <xsl:output method="xml" encoding="utf-8" indent="yes"/>

    <!-- Start of template -->
    <xsl:template match="ShipWorks">
    	<xsl:variable name="ship" select="Customer/Order/Address[@type='ship']" />
    	<xsl:variable name="bill" select="Customer/Order/Address[@type='bill']" />    
    	<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.ubiquia.com/zenventory/services/">	
    		<SOAP-ENV:Body>
		    	<ns1:SaveCustomerOrderRequest>
			    	<session id="">
			    		<user key="xxxxxxxxxxxxxxxxxxxxxxxxxx" /><!-- INSERT USER SECURE KEY HERE -->
                        
                        
			    	</session>
			    	<customerOrder orderNumber="{Customer/Order/Number}" placedOn="{Customer/Order/Date}">
			    		<xsl:for-each select="Customer/Order/Item">
			    			<items quantity="{Quantity}">
			    				<item sku="{SKU}" desc="{Name}" baseprice="{UnitPrice}" price="{UnitCost}" weight="{Weight}"/>
			    				<picker />
			    			</items>
			    		</xsl:for-each>
			    		<customer name="{$ship/FirstName}" surname="{$ship/LastName}" companyname="{$ship/Company}" 
			    			address1="{$ship/Line1}" address2="{$ship/Line2}" address3="{$ship/Line3}" city="{$ship/City}"
			    			state="{$ship/StateName}" countrycode="{$ship/CountryCode}" zip="{$ship/PostalCode}"
			    			emailaddress="{$ship/Email}" phone="{$ship/Phone}" billingaddress1="{$bill/Line1}"
			    			billinagaddress2="{$bill/Line2}" billingaddress3="{$bill/Line3}" billingcity="{$bill/City}" 
			    			billingstate="{$bill/StateName}" billingzip="{$bill/PostalCode}"
			    			billingcountrycode="{$bill/CountryCode}" billingphone="{$bill/Phone}"/>
			    	</customerOrder>
		    	</ns1:SaveCustomerOrderRequest>
		    </SOAP-ENV:Body>
    	</SOAP-ENV:Envelope>

    </xsl:template>
</xsl:stylesheet>