XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 June 1st, 2004, 04:10 PM
frankito frankito is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 frankito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Flattening XML with XSL

I just started using XSL this morning to try to solve a problem I am having reading XML into Access. I am somewhat familiar with Access, pretty new to XML, and very new to XSL.

The problem is that when I read the XML file into Access, it gets separated into several different, unlinked tables. I've learned that you can write a transform in XSL to "flatten" the table from the Microsoft site. The problem I am having is that when reading in information about a person, they often have a home telephone and a business telephone (XML is being generated elsewhere), so the person could have two telephone numbers in their record. The XML for the phone number is the same regardless of the phone type, and I can't get the XSL transformed output to show both. Even showing as a second record with being able to somehow being able to specificy in a field that the names are the same would be okay.

Does this make sense? Any help would be appreciated.

Thanks, Frank

Reply With Quote
  #2  
Old June 2nd, 2004, 07:30 AM
imbrokn imbrokn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: NJ
Posts: 428 imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 34 m 8 sec
Reputation Power: 10
Send a message via AIM to imbrokn
can you paste a XML node that would equate to a row in your database.

Reply With Quote
  #3  
Old June 2nd, 2004, 10:51 AM
frankito frankito is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 frankito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Don't know if this is "node" information or not - sorry I am not more familiar with the terminology.

Layer 1

<RECORDNO>
<ADDRESS>
</ADDRESS>
<PHONE>
</PHONE>
</RECORDNO>

Layer 2


<PHONE>
<phone_type> HM </phone_type>
<phone_number> 1234567891 </phone_number>
</PHONE>
<PHONE>
<phone_type> OT </phone_type>
<phone_number> 5555555555 </phone_number>
</PHONE>


What I was trying to do originally was have to have the database show

RECORD NO (some attributes like date created) ADDRESS (address, city ,etc) PHONE (phone_type, number) all in one record

When the XML file is read into Access now, everything goes in its own table RECORDNO, ADDRESS, PHONE etc. with no links among them and now way to rebuild the heirarchy from what I can tell.

I was told to try to transform the file using XSLT (?), which have attempted with some effort. I discovered that the data contains more than phone_type, so when I do the transformation, I'll get everything in one record, but it will only pick up one of the phone types.

Since I don't explicity know how many phone types there might be, it figured that I ought to put them in a separate table anyway as future XML files might not be imported properly. Which is to say I am now looking to see in Access:

Table 1:

RECORDNO (attributes) ADDRESS (attributes)

Table 2:

RECORDNO (recordID only as primary key) PHONE (attributes)

What I can't figure out is how to go "up" a level to attach recordID to the PHONE information in XSL.

I have attached the XSL code, which I have copied/learned from the Microsoft site. When I run it I get the current one PHONE per record result.

Any hints would be greatly appreciated. Thanks!
Attached Files
File Type: txt sample.txt (2.0 KB, 203 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Flattening XML with XSL


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway