Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2013, 10:58 AM
Registered User
 
Join Date: Apr 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default filter data using xslt with some addition logic

Hi

I want filter data using xslt1.0 along with addition of amount element.

Sample input XML file is ::


<apInvoiceLinesInterfaceCollection>

<ApInvoiceLinesInterface>
<invoiceLineId/>
<lineTypeLookupCode>ITEM</lineTypeLookupCode>
<amount>2833.33</amount>
<attribute1>S130328009</attribute1>
<attribute2>318043</attribute2>
<attribute3>ZCSU5972920</attribute3>
<attribute7>NA</attribute7>
<attribute14>SER001000029</attribute14>
<attribute15>ST-75-12</attribute15>
<distributionSetName>717101_4111108</distributionSetName>
</ApInvoiceLinesInterface>

<ApInvoiceLinesInterface>
<invoiceLineId/>
<lineTypeLookupCode>ITEM</lineTypeLookupCode>
<amount>666.67</amount>
<attribute1/>
<attribute2>318043</attribute2>
<attribute3/>
<attribute7/>
<attribute14>SER001000041</attribute14>
<attribute15>ST-75-12</attribute15>
<distributionSetName/>
</ApInvoiceLinesInterface>

<ApInvoiceLinesInterface>
<invoiceLineId/>
<lineTypeLookupCode>ITEM</lineTypeLookupCode>
<amount>2833.33</amount>
<attribute1>S130328009</attribute1>
<attribute2>318043</attribute2>
<attribute3>ZCSU5972920</attribute3>
<attribute7>NA</attribute7>
<attribute14>SER001000029</attribute14>
<attribute15>ST-75-12</attribute15>
<distributionSetName>717101_4111108</distributionSetName>
</ApInvoiceLinesInterface>

<ApInvoiceLinesInterface>
<invoiceLineId/>
<lineTypeLookupCode>ITEM</lineTypeLookupCode>
<amount>2833.33</amount>
<attribute1>S130328009</attribute1>
<attribute2>318043</attribute2>
<attribute3>ZCSU5972920</attribute3>
<attribute7>NA</attribute7>
<attribute14>SER001000029</attribute14>
<attribute15>ST-75-12</attribute15>
<distributionSetName>717101_4111108</distributionSetName>
</ApInvoiceLinesInterface>

</apInvoiceLinesInterfaceCollection>


If in ApInvoiceLinesInterface, elements attribute1, attribute2 & attribute14 having same value then create only one record(ApInvoiceLinesInterface ) but in amount element should have addition of all amount value which are consolidated...


So output file will be::

<apInvoiceLinesInterfaceCollection>

<ApInvoiceLinesInterface>
<invoiceLineId/>
<lineTypeLookupCode>ITEM</lineTypeLookupCode>
<amount>666.67</amount>
<attribute1/>
<attribute2>318043</attribute2>
<attribute3/>
<attribute7/>
<attribute14>SER001000041</attribute14>
<attribute15>ST-75-12</attribute15>
<distributionSetName/>
</ApInvoiceLinesInterface>

<ApInvoiceLinesInterface>
<invoiceLineId/>
<lineTypeLookupCode>ITEM</lineTypeLookupCode>
<amount>2833.33+2833.33+2833.33</amount>
<attribute1>S130328009</attribute1>
<attribute2>318043</attribute2>
<attribute3>ZCSU5972920</attribute3>
<attribute7>NA</attribute7>
<attribute14>SER001000029</attribute14>
<attribute15>ST-75-12</attribute15>
<distributionSetName>717101_4111108</distributionSetName>
</ApInvoiceLinesInterface>

</apInvoiceLinesInterfaceCollection>


Please, help me to solve it..





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT logic for repeating child elements within parent node Srinibondugula BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 5 November 8th, 2011 12:05 PM
Following XSLT Logic not Working sanket002 XSLT 11 October 27th, 2009 07:45 AM
Not able to implement the given logic in my XSLT ashyabhi_hp XSLT 2 January 27th, 2006 07:24 AM
XSLT Looping Logic - Very Urgent ujayaraman XSLT 2 March 3rd, 2005 10:42 AM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 07:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.