Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- XML FILE:
- <?xml version="1.0" encoding="UTF-8"?>
- <comtec version="2008">
- <trip>
- <id>15ORS</id>
- <code>test_lje_04</code>
- <name>test_lje_04</name>
- <trip_status>planned</trip_status>
- <trip_group>
- <code>default</code>
- <name>default</name>
- </trip_group>
- <department>
- <code>osdd</code>
- <name>osdd</name>
- <division>
- <code>default</code>
- <name>default</name>
- </division>
- </department>
- <from_instant>2013-05-24T07:00:00+02:00</from_instant>
- <till_instant>2013-05-24T22:05:00+02:00</till_instant>
- <start_window>
- <from_instant>2013-05-24T06:00:00+02:00</from_instant>
- <till_instant>2013-05-24T07:00:00+02:00</till_instant>
- </start_window>
- <finish_window>
- <from_instant>2013-05-24T22:00:00+02:00</from_instant>
- <till_instant>2013-05-24T23:00:00+02:00</till_instant>
- </finish_window>
- <reference_start_instant>2013-05-24T06:00:00+02:00</reference_start_instant>
- <reference_finish_instant>2013-05-24T23:00:00+02:00</reference_finish_instant>
- <allowForProposalPlan>true</allowForProposalPlan>
- <allowForBatchPlan>true</allowForBatchPlan>
- <comment/>
- <action id="450">
- <action_kind>
- <code>travel</code>
- <name>travel</name>
- <action_spec_code>travel</action_spec_code>
- <action_spec_name>travel</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2001-01-01T00:00:00+01:00</from_instant>
- <till_instant>2001-01-01T07:58:44+01:00</till_instant>
- <distance>503.207</distance>
- </planned>
- <expected>
- <from_instant>2001-01-01T00:00:00+01:00</from_instant>
- <till_instant>2001-01-01T07:58:44+01:00</till_instant>
- <distance>503.207</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="442">
- <action_kind>
- <code>couple</code>
- <name>couple</name>
- <action_spec_code>couple</action_spec_code>
- <action_spec_name>couple</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2013-05-24T07:00:00+02:00</from_instant>
- <till_instant>2013-05-24T07:05:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T07:00:00+02:00</from_instant>
- <till_instant>2013-05-24T07:05:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <couple>
- <resourceId>WT-704</resourceId>
- </couple>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="445">
- <action_kind>
- <code>coupling</code>
- <name>coupling</name>
- <action_spec_code>coupling</action_spec_code>
- <action_spec_name>coupling</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2013-05-24T07:00:00+02:00</from_instant>
- <till_instant>2013-05-24T07:05:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T07:00:00+02:00</from_instant>
- <till_instant>2013-05-24T07:05:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="454">
- <action_kind>
- <code>travel</code>
- <name>travel</name>
- <action_spec_code>travel</action_spec_code>
- <action_spec_name>travel</action_spec_name>
- </action_kind>
- <addressId>99999998-TESTORTE02</addressId>
- <planned>
- <from_instant>2013-05-24T07:05:00+02:00</from_instant>
- <till_instant>2013-05-24T08:22:39+02:00</till_instant>
- <distance>86.879</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T07:05:00+02:00</from_instant>
- <till_instant>2013-05-24T08:22:39+02:00</till_instant>
- <distance>86.879</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="453">
- <action_kind>
- <code>stop</code>
- <name>stop</name>
- <action_spec_code>stop</action_spec_code>
- <action_spec_name>stop</action_spec_name>
- </action_kind>
- <addressId>99999998-TESTORTE02</addressId>
- <planned>
- <from_instant>2013-05-24T08:22:39+02:00</from_instant>
- <till_instant>2013-05-24T11:01:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T08:22:39+02:00</from_instant>
- <till_instant>2013-05-24T11:01:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <load>
- <orderId>0000211000001460000100001</orderId>
- </load>
- <percentage_loaded>9</percentage_loaded>
- <stop_number>1</stop_number>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="456">
- <action_kind>
- <code>wait_task_available</code>
- <name>wait_task_available</name>
- <action_spec_code>wait_task_available</action_spec_code>
- <action_spec_name>wait_task_available</action_spec_name>
- </action_kind>
- <addressId>99999998-TESTORTE02</addressId>
- <planned>
- <from_instant>2013-05-24T08:22:39+02:00</from_instant>
- <till_instant>2013-05-24T11:00:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T08:22:39+02:00</from_instant>
- <till_instant>2013-05-24T11:00:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="436">
- <action_kind>
- <code>pickup</code>
- <name>pickup</name>
- <action_spec_code>pickup</action_spec_code>
- <action_spec_name>Pickup</action_spec_name>
- </action_kind>
- <addressId>99999998-TESTORTE02</addressId>
- <planned>
- <from_instant>2013-05-24T11:00:00+02:00</from_instant>
- <till_instant>2013-05-24T11:01:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T11:00:00+02:00</from_instant>
- <till_instant>2013-05-24T11:01:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <pickup>
- <orderId>0000211000001460000100001</orderId>
- <taskId>114ORTK</taskId>
- <order_info>
- <transports>
- <transport>
- <pickup_taskId>114ORTK</pickup_taskId>
- <deliver_taskId>113ORTK</deliver_taskId>
- <pickup_addressId>99999998-TESTORTE02</pickup_addressId>
- <delivery_addressId>3-ONTIOSLO21</delivery_addressId>
- <route_part>main</route_part>
- <department>
- <code>default</code>
- <name>default</name>
- <division>
- <code>default</code>
- <name>default</name>
- </division>
- </department>
- </transport>
- </transports>
- </order_info>
- </pickup>
- <load>
- <orderId>0000211000001460000100001</orderId>
- </load>
- <percentage_loaded>9</percentage_loaded>
- <stop_number>1</stop_number>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="458">
- <action_kind>
- <code>travel</code>
- <name>travel</name>
- <action_spec_code>travel</action_spec_code>
- <action_spec_name>travel</action_spec_name>
- </action_kind>
- <addressId>3-ONTIOSLO21</addressId>
- <planned>
- <from_instant>2013-05-24T11:01:00+02:00</from_instant>
- <till_instant>2013-05-24T12:00:26+02:00</till_instant>
- <distance>63.643</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T11:01:00+02:00</from_instant>
- <till_instant>2013-05-24T12:00:26+02:00</till_instant>
- <distance>63.643</distance>
- </expected>
- <percentage_loaded>9</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="457">
- <action_kind>
- <code>stop</code>
- <name>stop</name>
- <action_spec_code>stop</action_spec_code>
- <action_spec_name>stop</action_spec_name>
- </action_kind>
- <addressId>3-ONTIOSLO21</addressId>
- <planned>
- <from_instant>2013-05-24T12:00:26+02:00</from_instant>
- <till_instant>2013-05-24T12:01:26+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T12:00:26+02:00</from_instant>
- <till_instant>2013-05-24T12:01:26+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <stop_number>2</stop_number>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="437">
- <action_kind>
- <code>deliver</code>
- <name>deliver</name>
- <action_spec_code>deliver</action_spec_code>
- <action_spec_name>Deliver</action_spec_name>
- </action_kind>
- <addressId>3-ONTIOSLO21</addressId>
- <planned>
- <from_instant>2013-05-24T12:00:26+02:00</from_instant>
- <till_instant>2013-05-24T12:01:26+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T12:00:26+02:00</from_instant>
- <till_instant>2013-05-24T12:01:26+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <delivery>
- <orderId>0000211000001460000100001</orderId>
- <taskId>113ORTK</taskId>
- <order_info>
- <transports>
- <transport>
- <pickup_taskId>114ORTK</pickup_taskId>
- <deliver_taskId>113ORTK</deliver_taskId>
- <pickup_addressId>99999998-TESTORTE02</pickup_addressId>
- <delivery_addressId>3-ONTIOSLO21</delivery_addressId>
- <route_part>main</route_part>
- <department>
- <code>default</code>
- <name>default</name>
- <division>
- <code>default</code>
- <name>default</name>
- </division>
- </department>
- </transport>
- </transports>
- </order_info>
- </delivery>
- <percentage_loaded>0</percentage_loaded>
- <stop_number>2</stop_number>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="455">
- <action_kind>
- <code>travel</code>
- <name>travel</name>
- <action_spec_code>travel</action_spec_code>
- <action_spec_name>travel</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2013-05-24T12:01:26+02:00</from_instant>
- <till_instant>2013-05-24T12:31:53+02:00</till_instant>
- <distance>26.547</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T12:01:26+02:00</from_instant>
- <till_instant>2013-05-24T12:31:53+02:00</till_instant>
- <distance>26.547</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="452">
- <action_kind>
- <code>wait_action</code>
- <name>wait_action</name>
- <action_spec_code>wait_action</action_spec_code>
- <action_spec_name>wait_action</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2013-05-24T12:31:53+02:00</from_instant>
- <till_instant>2013-05-24T22:00:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T12:31:53+02:00</from_instant>
- <till_instant>2013-05-24T22:00:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="443">
- <action_kind>
- <code>decouple</code>
- <name>decouple</name>
- <action_spec_code>decouple</action_spec_code>
- <action_spec_name>decouple</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2013-05-24T22:00:00+02:00</from_instant>
- <till_instant>2013-05-24T22:05:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T22:00:00+02:00</from_instant>
- <till_instant>2013-05-24T22:05:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <decouple>
- <resourceId>WT-704</resourceId>
- </decouple>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- <action id="446">
- <action_kind>
- <code>decoupling</code>
- <name>decoupling</name>
- <action_spec_code>decoupling</action_spec_code>
- <action_spec_name>decoupling</action_spec_name>
- </action_kind>
- <addressId>99999998-TEST_NO2</addressId>
- <planned>
- <from_instant>2013-05-24T22:00:00+02:00</from_instant>
- <till_instant>2013-05-24T22:05:00+02:00</till_instant>
- <distance>0</distance>
- </planned>
- <expected>
- <from_instant>2013-05-24T22:00:00+02:00</from_instant>
- <till_instant>2013-05-24T22:05:00+02:00</till_instant>
- <distance>0</distance>
- </expected>
- <percentage_loaded>0</percentage_loaded>
- <resources>
- <resourceId>WT-704</resourceId>
- </resources>
- <revenue>0</revenue>
- </action>
- </trip>
- </comtec>
- XSLT FILE:
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns="http://www.kewill.com/logistics/klic/trip-plan" exclude-result-prefixes="fn xs">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
- <!-- Code conversion through eu1102 -->
- <xsl:include href="cwksbCodeConversion.xsl"/>
- <xsl:variable name="ol.custProspectCodeConversionFile">cwklic_codeMappings.xml</xsl:variable>
- <!-- Needed for translation of action codes from OTD to KL codes -->
- <xsl:key name="actionCode" match="actionCode" use="@actionCodeFrom"/>
- <xsl:param name="actionCode-map">
- <actionCode actionCodeFrom="couple" actionCodeTo="1"/>
- <actionCode actionCodeFrom="stop" actionCodeTo="5"/>
- <actionCode actionCodeFrom="decouple" actionCodeTo="2"/>
- <actionCode actionCodeFrom="pickup" actionCodeTo="3"/>
- <actionCode actionCodeFrom="deliver" actionCodeTo="4"/>
- </xsl:param>
- <xsl:template match="/comtec">
- <trip-plan type="tag">
- <ediCustomerNumber>99999996</ediCustomerNumber>
- <ediCustomerDepartment><xsl:value-of select="trip/department/code"/></ediCustomerDepartment>
- <ediParm1>4</ediParm1>
- <ediParm2>O</ediParm2>
- <ediParm3>T</ediParm3>
- <!--transmitter></transmitter-->
- <!--receiver></receiver-->
- <ediReference><xsl:value-of select="trip/id"/></ediReference>
- <!--referenceIndication></referenceIndication-->
- <!--internalShipmentNumber></internalShipmentNumber-->
- <ediFunction1>95</ediFunction1>
- <!--
- What does ediCustomerSearchName do?
- -->
- <!--ediCustomerSearchName>TODO - how to manage updates?</ediCustomerSearchName-->
- <!--reason></reason-->
- <!--employeesInitials></employeesInitials-->
- <xsl:apply-templates select="trip" />
- </trip-plan>
- </xsl:template>
- <xsl:template match="trip">
- <trip type="tag">
- <loadingDate><xsl:value-of select="substring(from_instant,1,10)"/></loadingDate>
- <loadingTime><xsl:value-of select="concat(substring(from_instant,12,5), ':00')"/></loadingTime>
- <unloadingDate><xsl:value-of select="substring(till_instant,1,10)"/></unloadingDate>
- <unloadingTime><xsl:value-of select="concat(substring(till_instant,12,5), ':00')"/></unloadingTime>
- <primaryReference><xsl:value-of select="code"/></primaryReference>
- <xsl:if test="comment !=''">
- <fileReferences type="tag">
- <referenceCode>OTD</referenceCode>
- <referenceText><xsl:value-of select="comment"/></referenceText>
- </fileReferences>
- </xsl:if>
- <xsl:for-each-group select="action" group-starting-with="action[action_kind/code = 'travel']">
- <xsl:variable name="travel-head" select="."/>
- <!--
- <test><xsl:value-of select="current-group()[self::action[action_kind/code = $actionCode-map/actionCode/@actionCodeFrom]]" /></test>
- <test2><xsl:value-of select="current-group()" /></test2>
- -->
- <xsl:apply-templates select="current-group()[self::action[action_kind/code = $actionCode-map/actionCode/@actionCodeFrom]]">
- <xsl:with-param name="travel" select="$travel-head"/>
- </xsl:apply-templates>
- </xsl:for-each-group>
- </trip>
- </xsl:template>
- <xsl:template match="action">
- <xsl:param name="travel"/>
- <xsl:copy>
- <code>
- <xsl:value-of select="key('actionCode', action_kind/code, $actionCode-map)/@actionCodeTo"/>
- </code>
- <value>
- <xsl:value-of
- select="if (not(exists((current-group() except $travel)
- [current() >> . and action_kind/code = $actionCode-map/actionCode/@actionCodeFrom])))
- then $travel/planned/distance else 0"/>
- </value>
- </xsl:copy>
- </xsl:template>
- <xsl:template name="createAddress">
- <xsl:param name="myAddressId" />
- <xsl:param name="myTypeOfAddress" />
- <address>
- <relationNumber><xsl:value-of select="substring-before($myAddressId,'-')"/></relationNumber>
- <typeOfAddress>
- <xsl:choose>
- <xsl:when test="$myTypeOfAddress = 'pickup'">
- <xsl:text>1</xsl:text>
- </xsl:when>
- <xsl:when test="$myTypeOfAddress = 'deliver'">
- <xsl:text>2</xsl:text>
- </xsl:when>
- <xsl:when test="$myTypeOfAddress = 'couple'"><!--pickup=loading e.g. -->
- <xsl:text>TODOFOR types like couple</xsl:text>
- </xsl:when>
- <xsl:when test="$myTypeOfAddress = 'coupling'"><!--pickup=loading e.g. -->
- <xsl:text>TODOFOR types like coupling</xsl:text>
- </xsl:when>
- <xsl:when test="$myTypeOfAddress = 'stop'"><!--pickup=loading e.g. -->
- <xsl:text>TODOFOR types like stop</xsl:text>
- </xsl:when>
- <xsl:when test="$myTypeOfAddress = 'travel'"><!--pickup=loading e.g. -->
- <xsl:text>TODOFOR types like travel</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$myTypeOfAddress" />
- </xsl:otherwise>
- </xsl:choose>
- </typeOfAddress>
- <searchName><xsl:value-of select="substring-after($myAddressId,'-')"/></searchName>
- </address>
- </xsl:template>
- <xsl:template name="createLeg">
- <xsl:param name="myActionKindCode" />
- <xsl:if test="$myActionKindCode = 'pickup' or $myActionKindCode = 'deliver'">
- <leg type="tag">
- <legReference>
- <xsl:choose>
- <xsl:when test="$myActionKindCode = 'pickup'">
- <xsl:value-of select="pickup/orderId"/>
- </xsl:when>
- <xsl:when test="$myActionKindCode = 'deliver'">
- <xsl:value-of select="delivery/orderId"/>
- </xsl:when>
- </xsl:choose>
- </legReference>
- </leg>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement