-2

I need to group qty based on same itemid. Header should appear as it is.

This XSLT will be used in BizTalk 2010. Any help would be very much appreciated.

I am using these XML and XSLT in BizTalk 2010 hence XSLT ver 2.0 is not supported

I have seen so many examples but not working for me nor I'm making mistakes.

Here is my input

    <Invoice>
        <LineHeader>
            <ContractorID>1</ContractorID>
            <ContractorName>XXX</ContractorName>
            <InvoiceDate>1999-05-31</InvoiceDate>
            <GSTCode>AUS</GSTCode>
        </LineHeader>
        <LineItems>
            <LineItem>
                <ItemID>1</ItemID>
                <Qty>10</Qty>
            </LineItem>

            <LineItem>
                <ItemID>2</ItemID>
                <Qty>20</Qty>
            </LineItem>

            <LineItem>
                <ItemID>1</ItemID>
                <Qty>-3</Qty>
            </LineItem>


        </LineItems>
    </Invoice>

My output should be

    <Invoice>
        <LineHeader>
            <ContractorID>1</ContractorID>
            <ContractorName>XXX</ContractorName>
            <InvoiceDate>1999-05-31</InvoiceDate>
            <GSTCode>AUS</GSTCode>
        </LineHeader>
        <LineItems>
            <LineItem>
                <ItemID>1</ItemID>
                <Qty>7</Qty>
            </LineItem>

            <LineItem>
                <ItemID>2</ItemID>
                <Qty>20</Qty>
            </LineItem>
        </LineItems>
    </Invoice>

There are three line items in input, but only two in output. ItemID 1 is grouped and qty is calculated as 10

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
krisrajz
  • 11
  • 1
  • 4

1 Answers1

-1

Here the input I took

http://www.sharexml.com/x/get?k=qbbVk8enuoNF

And here is the XSLT doing the trick

http://www.sharexml.com/x/get?k=F9zGd5aTG2t7

innovimax
  • 440
  • 5
  • 8