Example of typical XSL for PrintDocumentSet()

This topic provides an example of a typical XSL that generates the input to the PrintDocumentSet() API.

   <?xml version = "1.0" encoding = "UTF-8"?>
   <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" 
     version = "1.0">
   <xsl:output indent="yes"/>
   <xsl:template match="Print | Shipment">
   <PrintDocuments>
   <xsl:attribute name="PrintName">
   <xsl:text>packList</xsl:text>
   </xsl:attribute>
   <xsl:attribute name="FlushToPrinter">
   <xsl:text>Y</xsl:text>
   </xsl:attribute>
   <PrintDocument>
   <xsl:attribute name="BeforeChildrenPrintDocumentId">
   <xsl:text>PACKLIST</xsl:text>
   </xsl:attribute>
   <xsl:attribute name="DataElementPath">
   <xsl:text>xml:/Shipment</xsl:text>
   </xsl:attribute>
   <xsl:choose>
   <xsl:when test="name()=&quot;Print&quot;">
   <xsl:copy-of select="PrinterPreference"/>
   <xsl:copy-of select="LabelPreference"/>
   </xsl:when>
   <xsl:when test="name()=&quot;Shipment&quot;">
   <PrinterPreference>
   <xsl:attribute name="PrinterId"/>
   <xsl:attribute name="UsergroupId"/>
   <xsl:attribute 
      name="UserId"><xsl:text>xml:/Shipment/@Modifyuserid</xsl:text>
      </xsl:attribute>
   <xsl:attribute name="WorkStationId"/>
   <xsl:attribute 
      name="OrganizationCode"><xsl:text>xml:/Shipment/ShipNode/
      @NodeOrgCode</xsl:text></xsl:attribute>
   </PrinterPreference>
   <LabelPreference>
   <xsl:attribute name="EnterpriseCode">
   <xsl:text>xml:/Shipment/@EnterpriseCode</xsl:text>
   </xsl:attribute>
   <xsl:attribute name="BuyerOrganizationCode">
   <xsl:text>xml:/Shipment/@BuyerOrganizationCode</xsl:text>
   </xsl:attribute>
   <xsl:attribute name="SellerOrganizationCode">
   <xsl:text>xml:/Shipment/@SellerOrganizationCode</xsl:text>
   </xsl:attribute>
   </LabelPreference>
   </xsl:when>
   </xsl:choose>
   <KeyAttributes>
   <KeyAttribute>
   <xsl:attribute name="Name"><xsl:text>ShipmentKey</xsl:text></xsl:attribute>
   </KeyAttribute>
   </KeyAttributes>
   <InputData>
   <xsl:attribute name="FlowName">
   <xsl:text>GetPackListData</xsl:text>
   </xsl:attribute>
   <Shipment>
   <xsl:choose>
   <xsl:when test="name()=&quot;Print&quot;">
   <xsl:copy-of select="Shipment/@*" /> 
   </xsl:when>
   <xsl:when test="name()=&quot;Shipment&quot;">
   <xsl:copy-of select="@*" /> 
   </xsl:when>
   </xsl:choose>   
   </Shipment>
   <Template>
   <Api Name="getShipmentDetails">
   <Template>   
   <Shipment>
   <SellerOrganization>
   <CorporatePersonInfo/>
   </SellerOrganization>
   <Carrier/>
   <MarkForAddress/>
   <BillingInformation>
   <AlternateParty/>
   </BillingInformation>
   <Instructions>
   <Instruction/>
   </Instructions>
   <FromAddress/>
   <ToAddress/>
   <ShipmentLines>
   <ShipmentLine CountryOfOrigin="" FifoNo="" ItemDesc="" ItemID="" 
     OrderHeaderKey="" OrderLineKey="" OrderNo="" OrderReleaseKey="" 
     PrimeLineNo="" ProductClass="" Quantity="" ReleaseNo="" Segment="" 
     SegmentType="" ShipmentKey="" ShipmentLineKey="" ShipmentLineNo="" 
     SubLineNo="" UnitOfMeasure="" BackOrderedQty="" ShipmentSubLineNo="">
   <Order/>
   <OrderLine>
   <Item/>
   <OrderStatuses>
   <OrderStatus OrderHeaderKey="" OrderLineKey="" OrderLineScheduleKey="" 
     OrderReleaseKey="" OrderReleaseStatusKey="" PipelineKey="" 
     ReceivingNode="" ShipNode="" Status="" StatusDate="" 
     StatusDescription="" StatusQty="" StatusReason="" TotalQuantity="">
   <OrderStatusTranQuantity StatusQty="" TotalQuantity="" 
     TransactionalUOM="" /> 
   <Details ExpectedDeliveryDate="" ExpectedShipmentDate="" ShipByDate="" 
     TagNumber="">
   </Details>
   </OrderStatus>
   </OrderStatuses>
   </OrderLine>      
   </ShipmentLine>
   </ShipmentLines>
   <Containers>
   <Container>
   <ContainerDetails>
   <ContainerDetail>
   <ShipmentLine>
   <OrderLine>
   <Item/>
   </OrderLine>
   </ShipmentLine>
   </ContainerDetail>
   </ContainerDetails>
   </Container>
   </Containers>
   <ShipNode>
   <ShipNodePersonInfo/>
   </ShipNode>
   </Shipment>
   </Template>
   </Api>   
   </Template>
   </InputData>
   </PrintDocument>
   </PrintDocuments>
   </xsl:template>
   </xsl:stylesheet>

Format for input XML to XSL translator

The Input XML to the above XSL translator should belong to either of the following formats:

<Shipment ShipmentKey=""/>

OR

<Print><Shipment ShipmentKey=""/><LabelPreference EnterpriseCode=""/><Printer
Preference UserId="" UsergroupId=""/></Print>

The former input XML is passed when the service is invoked from an event, while the latter is passed when the service is invoked from the console (UI).

XML generated after XSL translation

The following is an example of the XML generated after the XSL Translation using the above mentioned XSL:

   <?xml version = "1.0" encoding = "UTF-8"?>
   <PrintDocuments PrintName="packList" FlushToPrinter="Y">
   <PrintDocument Localecode="xml:/Shipment/ShipNode/@Localecode">
   <InputData APIName="getShipmentDetails">
   <Shipment ShipmentKey="">
   </Shipment>
   <Template>   
   <Shipment>
   <ShipNode>
   <ShipNodePersonInfo/>
   </ShipNode>
   </Shipment>
   </Template>
   </InputData>
   </PrintDocument>
   <PrintDocument BeforeChildrenPrintDocumentId="PACKLIST" 
     DataElementPath="xml:/Shipment">
   <PrinterPreference PrinterId="" UserId="xml:/Shipment/@Modifyuserid" 
     UsergroupId="" WorkStationId="" 
     OrganizationCode="xml:/Shipment/ShipNode/@NodeOrgCode"/>
   <LabelPreference EnterpriseCode="xml:/Shipment/@EnterpriseCode"  
     BuyerOrganizationCode="xml:/Shipment/@BuyerOrganizationCode"  
     SellerOrganizationCode="xml:/Shipment/@SellerOrganizationCode" />
   <KeyAttributes>
   <KeyAttribute Name="ShipmentKey"/>
   </KeyAttributes>
   <InputData FlowName="GetPackListData">
   <Shipment ShipmentKey=""/>
   <Template>
   <Api Name="getShipmentDetails">
   <Template>   
   <Shipment ShipmentKey="" ShipmentNo="" ActualShipmentDate="" 
     ExpectedShipmentDate="">
   <SellerOrganization OrganizationCode="">
   <CorporatePersonInfo AddressLine1="" AddressLine2="" FirstName="" 
     MiddleName="" LastName="" City="" State="" Country="" ZipCode="" />
   </SellerOrganization>
   <Carrier Scac="" ScacDesc=""/>
   <MarkForAddress/>
   <BillingInformation ShipmentChargeType=""/>
   <Instructions>
   <Instruction InstructionType="" InstructionText=""/>
   </Instructions>
   <ToAddress/>
   <ShipmentLines>
   <ShipmentLine ItemDesc="" ItemID="" OrderHeaderKey="" OrderLineKey="" 
    OrderNo="" OrderReleaseKey="" PrimeLineNo=""  Quantity="" ReleaseNo="" 
    ShipmentKey="" ShipmentLineKey="" ShipmentLineNo="" SubLineNo="" 
    UnitOfMeasure="" BackOrderedQty="" ShipmentSubLineNo="">
   <Order OrderHeaderKey="" OrderNo="">
   <PersonInfoBillTo AddressLine1="" AddressLine2="" FirstName="" MiddleName="" 
    LastName="" City="" State="" Country="" ZipCode=""  />
   </Order>
   <OrderLine  CustomerPONo=""  OrderLineKey="" OrderedQty="" 
    OriginalOrderedQty=""   Status="" StatusQuantity="" SubLineNo="" >
   <Item CustomerItem=""/>
   <OrderStatuses>
   <OrderStatus OrderLineKey="" OrderReleaseStatusKey=""  Status=""  
    StatusQty="" TotalQuantity=""/>
   </OrderStatuses>
   </OrderLine>      
   </ShipmentLine>
   </ShipmentLines>
   <ShipNode NodeOrgCode=""/>
   </Shipment>
   </Template>
   </Api>
   </Template>
   </InputData>
   </PrintDocument>
   </PrintDocuments>