Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Challenge: Join nodes and group by attribute

Status
Not open for further replies.

jluost1

Programmer
Jun 8, 2001
78
US
My XML structure:
---------------------------
<INVOICE>
<TASKS>
<TASK ID=1000 NUMBER=&quot;01.A001&quot;>
<TASK ID=2000 NUMBER=&quot;01.A002&quot;>
<TASK ID=3000 NUMBER=&quot;01.B001&quot;>
<TASK ID=4000 NUMBER=&quot;01.B005&quot;>
</TASKS>
<LINE>
<TASK>1000</TASK>
<AMOUNT>$1000</AMOUNT>
</LINE>
<LINE>
<TASK>1000</TASK>
<AMOUNT>$2000</AMOUNT>
</LINE>
<LINE>
<TASK>2000</TASK>
<AMOUNT>$2000</AMOUNT>
</LINE>
<LINE>
<TASK>3000</TASK>
<AMOUNT>$3000</AMOUNT>
</LINE>
<LINE>
<TASK>4000</TASK>
<AMOUNT>$5000</AMOUNT>
</LINE>
</INVOICE>
---------------------------

Desired HTML output:
---------------------------
Task Amount
01.A $4000 ($1000+$2000+2000)
01.B $8000 ($3000+$5000)
---------------------------

Task is taken from the first 4 chars of INVOICE/TASKS/TASK/@NUMBER and group them together.

The challenge for me is how to look up the TASKS/TASK/@NUMBER in LINE/TASK/@text().

If a single XSL can not achieve this, can you tell me how to insert TASKS/TASK/@NUMBER into LINE/TASK/@NUMBER so the LINE would be like

-------
<LINE>
<TASK NUMBER=&quot;01.A001&quot;>1000</TASK>
<AMOUNT>$1000</AMOUNT>
</LINE>
-----


Any suggestion? Thank you.
 
Let me repost it with the valid XML:

My XML structure:
---------------------------
<INVOICE>
<TASKS>
<TASK ID=&quot;1000&quot; NUMBER=&quot;01.A001&quot;/>
<TASK ID=&quot;2000&quot; NUMBER=&quot;01.A002&quot;/>
<TASK ID=&quot;3000&quot; NUMBER=&quot;01.B001&quot;/>
<TASK ID=&quot;4000&quot; NUMBER=&quot;01.B005&quot;/>
</TASKS>
<LINE>
<TASK>1000</TASK>
<AMOUNT>$1000</AMOUNT>
</LINE>
<LINE>
<TASK>1000</TASK>
<AMOUNT>$2000</AMOUNT>
</LINE>
<LINE>
<TASK>2000</TASK>
<AMOUNT>$2000</AMOUNT>
</LINE>
<LINE>
<TASK>3000</TASK>
<AMOUNT>$3000</AMOUNT>
</LINE>
<LINE>
<TASK>4000</TASK>
<AMOUNT>$5000</AMOUNT>
</LINE>
</INVOICE>
---------------------------

Desired HTML output:
---------------------------
Task Amount
01.A $4000 ($1000+$2000+2000)
01.B $8000 ($3000+$5000)
---------------------------

Task is taken from the first 4 chars of INVOICE/TASKS/TASK/@NUMBER and group them together.

The challenge for me is how to look up the TASKS/TASK/@NUMBER in LINE/TASK/@text().

If a single XSL can not achieve this, can you tell me how to insert TASKS/TASK/@NUMBER into LINE/TASK/@NUMBER so the LINE would be like

-------
<LINE>
<TASK NUMBER=&quot;01.A001&quot;>1000</TASK>
<AMOUNT>$1000</AMOUNT>
</LINE>
-----


Any suggestion? Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top