XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 16th, 2001, 08:44 AM
SurvivorJoe SurvivorJoe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 38 SurvivorJoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 37 m 9 sec
Reputation Power: 12
Question How do I match up elements in my XSL?

I have an XML file created with VorteXML. In the file, I have the following tree structure:
<Investment Category>
<Subcategory name="Somename">
<Industry>
<Companies>
<Shares>
<Price>
<Current_Value>
<etc...>
</Companies>
<Industry_Totals> Data </Industry_Totals>
</Industry>
</Subcategory>
</Investment_ Category>

Later in the XML file, there are the Subcategory Totals, for example <Subcategory_Total name="Total Somename">

Due to a problem with VorteXML, the program does not create XML when the subcategory total section is nested where it shoud be. The problem I have is when my XSL is creating the HTML, I need the subcategory totals to be inserted right before the </Subcategory> tag. Since I need to match up the proper subcategory total with the proper subcategory section (there can be 7, 8, or 9, depending on the client, meaning I can't hardcode each set in), how do I match up one set of elements with another? Here is an abbreviated sample of the XML file, showing two of my subcategories. I need to get the subtotal for the CONSUMER DURABLES to be at the end of the CONSUMER DURABLES subcategory section and the same for the CONSUMER NON-DURABLES. Any ideas?

<total_equities>
<tot_equ_cost>13435407.60</tot_equ_cost>
<tot_equ_value>15288742.90</tot_equ_value>
</total_equities>
<subcategory name="CONSUMER NON-DURABLES">
<industry name="BEVERAGES">
<companies>
<shares>9400</shares>
<company_name>PEPSIAMERICAS INC</company_name>
<purch_avg_cost>12.62</purch_avg_cost>
<purch_total_cost>118672.40</purch_total_cost>
</companies>
<industry_total>
<industry_name>TOTAL BEVERAGES</industry_name>
<industry_cost>118672.40</industry_cost>
<industry_value>147580.00</industry_value>
</industry_total>
</industry>
<industry name="COSMETICS">
<companies>
<shares>1600</shares>
<company_name>ALBERTO CULVER CO</company_name>
<purch_avg_cost>20.53</purch_avg_cost>
<purch_total_cost>32844.49</purch_total_cost>
</companies>
<companies>
<shares>4200</shares>
<comp_name>INTERNATIONAL FLAVORS</comp_name>
<purch_avg_cost>21.89</purch_avg_cost>
<purch_total_cost>91917.98</purch_total_cost>
</companies>
<industry_total>
<industry_name>TOTAL COSMETICS</industry_name>
<industry_cost>124762.47</industry_cost>
<industry_value>184230.00</industry_value>
<industry_percent>1.1</industry_percent>
<industry_income>3048.00</industry_income>
<industry_yield>1.7</industry_yield>
</industry_total>
</industry>
</subcategory>
<subcategory name="CONSUMER DURABLES">
<industry name="AUTOMOTIVE EQUIPMENT">
<companies>
<shares>3700</shares>
<company_name>CUMMINS INC</company_name>
<purch_avg_cost>42.31</purch_avg_cost>
<purch_total_cost>156553.24</purch_total_cost>
</companies>
<companies>
<shares>5500</shares>
<company_name>HUBBELL INC</company_name>
<purch_avg_cost>26.70</purch_avg_cost>
<purch_total_cost>146831.98</purch_total_cost>
<current_price>29.13</current_price>
<current_value>160215.00</current_value>
<port_percent>1.0</port_percent>
<income>7260.00</income>
<current_yield>4.5</current_yield>
</companies>
<industry_total>
<industry_name>TOTAL AUTOMOTIVE EQUIPMENT</industry_name>
<industry_cost>662449.91</industry_cost>
<industry_value>722386.00</industry_value>
</industry_total>
</industry>
<industry name="TEXTILES & SHOES">
<companies>
<shares>5700</shares>
<company_name>PHILLIPS VAN HEUSEN</company_name>
<purch_avg_cost>14.56</purch_avg_cost>
<purch_total_cost>82964.64</purch_total_cost>
</companies>
<companies>
<shares>6400</shares>
<company_name>RUSSELL CORP</company_name>
<purch_avg_cost>15.34</purch_avg_cost>
<purch_total_cost>98183.24</purch_total_cost>
</companies>
<industry_total>
<industry_name>TOTAL TEXTILES & SHOES</industry_name>
<industry_cost>181147.88</industry_cost>
<industry_value>193629.00</industry_value>
</industry_total>
</industry>
</subcategory>
<total_subcategory>
<total_subcategory_name>TOTAL CONSUMER NON-DURABLES</total_subcategory_name>
<total_subcategory_cost>3202919</total_subcategory_cost>
<total_subcategory_value>3800868</total_subcategory_value>
</total_subcategory>
<total_subcategory>
<total_subcategory_name>TOTAL CONSUMER DURABLES</total_subcategory_name>
<total_subcategory_cost>958340</total_subcategory_cost>
<total_subcategory_value>1068607</total_subcategory_value>
</total_subcategory>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > How do I match up elements in my XSL?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap