473,770 Members | 3,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating new subtotal nodes grouped by 2 values

I'm fairly new to XSL, but have made some good progress in picking it
up for the project I'm currently working on. I've been trying to
figure out how to design a stylesheet that would transform the XML I'm
recieving so that the tax information I'm recieving per item could be
grouped and added per state and have the new subtotal node located
inside the last node of a particular STORE value.

I'm trying to use the Muenchian Method, but I can't seem to wrap my
brain around it. The XML is already sorted by STORE, so I'm just
trying to figure out how to use Muenchian properly to get the desired
XML. I could really use some help in trying to figure out how to
group and subtotal the tax nodes and get the output I desire. Thanks
in advance.

Input:

<INV>
<PAGE num="1">
<STORE>1</STORE>
<ITEM>X</ITEM>
<TAX num="1">
<STATE>GA</STATE>
<TOTAL>10</TOTAL>
</TAX>
</PAGE>

<PAGE num="2">
<STORE>1</STORE>
<ITEM>Y</ITEM>
<TAX num="1">
<STATE>GA</STATE>
<TOTAL>5</TOTAL>
<TAX>
</TAX num="2">
<STATE>FL</STATE>
<TOTAL>5</TOTAL>
</TAX>
</PAGE>

<PAGE num="3">
<STORE>1</STORE>
<ITEM>Misc.</ITEM>
<TAX num="1">
<STATE>FL</STATE>
<TOTAL>5</TOTAL>
<TAX>
</TAX num="2">
<STATE>SC</STATE>
<TOTAL>5</TOTAL>
</TAX>
</PAGE>

<PAGE num="4">
<STORE>2</STORE>
<ITEM>Z</ITEM>
<TAX num="1">
<STATE>GA</STATE>
<TOTAL>0</TOTAL>
</TAX>
</PAGE>
</INV>

Desired Output:

<INV>
<PAGE num="1">
<STORE>1</STORE>
<ITEM>X</ITEM>
</PAGE>
<PAGE num="2">
<STORE>1</STORE>
<ITEM>Y</ITEM>
</PAGE>
<PAGE num="3">
<STORE>1</STORE>
<ITEM>Misc.</ITEM>
<TAX_SUBTOTAL >
<SUB_TAX num="1">
<SUB_STATE>GA </STATE>
<SUB_TOTAL>15 </STATE>
</SUB_TAX>
<SUB_TAX num="2">
<SUB_STATE>SC </STATE>
<SUB_TOTAL>5</STATE>
</SUB_TAX>
<SUB_TAX num="3">
<SUB_STATE>FL </STATE>
<SUB_TOTAL>10 </STATE>
</SUB_TAX>
<TAX_SUBTOTAL >
</PAGE>
<PAGE num="4">
<STORE>2</STORE>
<ITEM>Z</ITEM>
<TAX_SUBTOTAL >
<SUB_TAX num="2">
<SUB_STATE>GA </STATE>
<SUB_TOTAL>0</STATE>
</SUB_TAX>
<TAX_SUBTOTAL >
</PAGE>
</INV>
Jul 20 '05 #1
0 1381

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7957
by: Jeffrey Silverman | last post by:
Hi, all. I have a linked list. I need an algorithm to create a tree structure from that list. Basically, I want to turn this: $list = array( array( 'id' => 'A', 'parent_id' => null, 'value' => 'aaa') , array( 'id' => 'B', 'parent_id' => 'A', 'value' => 'bbb') , array( 'id' => 'C', 'parent_id' => 'B', 'value' => 'ccc') , array( 'id' => 'D', 'parent_id' => 'A', 'value' => 'ddd')
3
15003
by: Indraneel Sheorey | last post by:
Hello, I want to set up a query in SQL Server that is "grouped by" a variable PRICE. Since PRICE takes on continuous decimal values, I want to create deciles based on this variable and then display the average price in each decile. As background, PRICE is a calculated quantity: I divide a table field SLS_DLRS by a field SLS_UNTS to get it. I also want to include an average SLS_UNTS for each decile. So essentially, I want the result...
2
1907
by: Chris via AccessMonster.com | last post by:
I have done something like this a million years ago my developer skills have diminished to nothing but now I am at a new job trying to regroup what I lost. This one came across my desk recently. I need to create tables based on grouped recordsets the additional challenge is that the table name would equal the value or variable of the grouped recordset. Example below Field_1 Field_2 Field_3 email@email.com Boston ...
3
1693
by: ChadDiesel | last post by:
I'm new to Access and need some advice. I am trying to setup a database to print labels and reports for our shipments. I have set up a table with fields such as I have taken a snapshot of what I would like to do: http://www.chadworld.com/images/form.jpg All of these fields are in a table called: Ship_Info
7
1466
by: David Hirschfield | last post by:
Here's the problem: Given a list of item names like: apple1 apple2 apple3_SD formA formB formC kla_MM kla_MB
1
1535
by: Chris | last post by:
I have a problem with grouping elements in my XSL. What I want to do is select all of the distinct SCE_CGPC records, then by the FSG_SNAM records for each SCE_CGPC and then again by MOA_NAME for each SCE_CGPC and FSG_SNAM. I have included a achunk of my XML to help expalin this: This is a chunk of the XML file <z:row SCE_CGPC='PGRE' FSG_SNAM='HOME' MOA_NAME='Full time'
1
1825
by: renfrochris | last post by:
I'm having difficulty finding the correct syntax that will allow me to select a group of invoices based on the total of an amount column located in its line items. Below are simplified examples of my XML and XSLT files: XML FILE <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="OutstandingInvoiceBalances.xslt"?>
5
3977
by: mebrabham | last post by:
Hello, I am trying to create a running subtotal in a query and then graph the running subtotal for each city group. The data looks like this in the table (for illustration): My City My Date Cumulative Sum Daily Sum DC 03-Apr-07 6 6 DC 04-Apr-07 20 14 DC 05-Apr-07 0 0 DC 06-Apr-07 24 4
2
1944
by: murch.alexander | last post by:
Hi all, I have a query that uses a subquery to subtotal one of its fields. This part is working fine. The twist is that when I encounter certain values, I want to reset the subtotal to zero and continue on. So, it's possible that out of 100 records, I might reset the subtotal to zero 20 times. I can do this in a report but I need it in query form so I can run it automatically when users log in to let them know if the subtotal has
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9869
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.