I want to compare quantities and if the quantities match, assign "Y" to a varaible in xsl.
The output xml should have a copy of the input xml and an ExtnXSL element in the end with ExtnXSLCompleteShipment attribute with "Y" value if the Quantity and the OrderedQuantity match for the same primelineNo.
Here is the Input XML.
<?xml version="1.0"?>
<Receipt DocumentType="0005" ReceivingNode="110">
<Shipment DocumentType="0005" EnterpriseCode="MatrixUSA" OrderNo="Y100000123" ReceivingNode="110"/>
<ReceiptLines>
<ReceiptLine PrimeLineNo="" SubLineNo="" OrderNo="Y100000123" Quantity="50.00"/>
</ReceiptLines>
<OrderDetails>
<Order OrderHeaderKey="201402041210274226042" OrderNo="Y100000123" EnterpriseCode="MatrixUSA" DocumentType="0005">
<OrderLines>
<OrderLine OrderedQuantity="50" PrimeLineNo="1" SubLineNo="1" >
<ChainedFromOrderLine>
<Order>
<Extn ExtnSpecialHandlingFlagt="N" />
</Order>
</ChainedFromOrderLine>
</OrderLine>
</OrderLines>
</Order>
</OrderDetails>
</Receipt>
Here is the output xml
<?xml version="1.0"?>
<Receipt DocumentType="0005" ReceivingNode="110">
<Shipment DocumentType="0005" EnterpriseCode="MatrixUSA" OrderNo="Y100000123" ReceivingNode="110"/>
<ReceiptLines>
<ReceiptLine PrimeLineNo="" SubLineNo="" OrderNo="Y100000123" Quantity="50.00"/>
</ReceiptLines>
<OrderDetails>
<Order OrderHeaderKey="201402041210274226042" OrderNo="Y100000123" EnterpriseCode="MatrixUSA" DocumentType="0005">
<OrderLines>
<OrderLine OrderedQuantity="50" PrimeLineNo="1" SubLineNo="1" >
<ChainedFromOrderLine>
<Order>
<Extn ExtnSpecialHandlingFlagt="N" />
</Order>
</ChainedFromOrderLine>
</OrderLine>
</OrderLines>
</Order>
</OrderDetails>
<ExtnXSL ExtnXSLSpecialHandlingFlag="N" ExtnXSLCompleteShipment="Y" />
</Receipt>
Here is the xsd for ExtnXSL with which I need help with:
<ExtnXSL>
<xsl:variable name="completeShipment">
<xsl:for-each select="Receipt/ReceiptLines/ReceiptLine">
<xsl:variable name="receiptQty" select="@Quantity"/>
<xsl:varaible name="rPrimeLineNo" select="@PrimeLineNo"/>
<xsl:for-each select="//Receipt/OrderDetails/Order/OrderLines/OrderLine[PrimeLineNo=rPrimeLineNo]">
<xsl:varaible name="orderedQty" select="@OrderedQuantity"/>
<xsl:if test="orderedQty != receiptQty">
<xsl:value-of select="'N'"/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:if test="completeShipment != 'N'">
<xsl:variable name="completeShipment" select="'Y'"/>
</xsl:if>
<xsl:attribute name="ExtnXSLSpecialHandlingFlag">
<xsl:value-of select="'N'"/>
</xsl:attribute>
<xsl:attribute name="ExtnXSLCompleteShipment">
<xsl:value-of select="$completeShipment"/>
</xsl:attribute>
</ExtnXSL>
No comments:
Post a Comment