473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 1348

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

Similar topics

5
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'...
3
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...
2
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...
3
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...
7
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
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...
1
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...
5
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...
2
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.