<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0"
                xmlns:ScriptNS1="http://schemas.microsoft.com/BizTalk/2003/ScriptNS1"
                
                xmlns:DateTime="TM.Shared.Components.DateTime"
                 xmlns:KeyList="TM.Shared.Components.KeyList"
                     xmlns:SSO="TM.Shared.Components.SSO"
                  xmlns:String="TM.Shared.Components.String"
                
                xmlns:Bosman="TM.Bosman.Components.MSsql"

                xmlns:s0="http://TM.KLG.com/KLG/Order"
                xmlns:ns0="http://TM.KLG.com/KLG/Order"
                
                exclude-result-prefixes="s0 ns0 ScriptNS0 ScriptNS1 DateTime KeyList SSO String Bosman">

  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" indent="yes" />

  <!-- Region global variable initialization -->

  <!-- end region -->

  <!-- region templates -->
  
  <xsl:template match="/">
    <xsl:apply-templates select="/s0:Order" />
  </xsl:template>

  <xsl:template match="/s0:Order">
    <ns0:Order>
      <Reference>
        <xsl:value-of select="Reference"/>
      </Reference>
      <TimeStamp>
        <xsl:value-of select="TimeStamp"/>
      </TimeStamp>
      <xsl:for-each select="Shipment">
        <ns0:Shipment>
          <ConsignorReference>
            <xsl:value-of select="ConsignorReference"/>
          </ConsignorReference>
          <Update>
            <xsl:value-of select="Bosman:AddReference(ConsignorReference)"/>
          </Update>
        </ns0:Shipment>
      </xsl:for-each>
    </ns0:Order>
  </xsl:template>

  <!-- end region -->

</xsl:stylesheet>