Transpose XML file into table

Is there a way to transpose the XML data attached into a table with column names?

in the snippet attached everything would repeat the same down to the availability info, and the availability info can repeat itself x times

so if there were 3 "sets" of availability info...
resortID through privacyOccupancy would always be the first 7 columns and would repeat for 3 records with inventoryType through unitCount being different for the three records.


<accommodationItem>
            <resortId>0450</resortId>
            <resortName>Sheraton Vistana Resort</resortName>
            <nbrOfBedrooms>2</nbrOfBedrooms>
            <nbrOfBathrooms>0.0</nbrOfBathrooms>
            <kitchenType>Full Kitchen</kitchenType>
            <maxOccupancy>8</maxOccupancy>
            <privacyOccupancy>6</privacyOccupancy>
            <availabilityInfo>
                <systemId>
                    <inventoryType>1</inventoryType>
                    <inventoryId>rNnn6T4Gwje4d71WOejhsXgtWrNbxbMWJzoakGRFDrTEhWAqo2rI4ALOtq+vOkUx</inventoryId>
                </systemId>
                <checkInDate>05/29/2009</checkInDate>
                <checkOutDate>06/05/2009</checkOutDate>
                <unitCost>
                    <value>325.00</value>
                    <currency>USD</currency>
                </unitCost>
                <unitCount>1</unitCount>
            </availabilityInfo>

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Melih SARICAOwnerCommented:
try this One.. It gives Idea
<?xml version="1.0" encoding="ISO-8859-9"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method = "xml" /> 
<xsl:template match = "/" > 
<xsl:for-each select = "/accommodationItem" >
<table cellspacing="5" cellpadding="2" style="border:1px solid #cccccc;width:250px" >
<tr ><td ><xsl:value-of select ="./resortName" /></td></tr>
<tr style="font-size:11px">
<td   >
	Number of Bedrooms : <xsl:value-of select ="./nbrOfBedrooms" />
	Number of BathRooms: <xsl:value-of select ="./nbrOfBathrooms" />
	Kitchen Type: <xsl:value-of select ="./kitchenType" />
</td></tr>
<xsl:for-each select = "./availabilityInfo" >
<tr style="font-size:11px">
<td >
        CheckIn : <xsl:value-of select ="./checkInDate" />
	CheckOut: <xsl:value-of select ="./checkOutDate" />
	Cost: <xsl:value-of select ="./unitCost/value" /><xsl:value-of select ="./unitCost/currency" />
</td></tr>
</xsl:for-each>
</table> 
</xsl:for-each>
</xsl:template> 
</xsl:stylesheet> 

Open in new window

0
Larry Bristersr. DeveloperAuthor Commented:
non_zero:

Is there a way to place that in a dataset?
0
Larry Bristersr. DeveloperAuthor Commented:
And how do I use it?
0
Melih SARICAOwnerCommented:
What i send is for transform.. U  can use it with xmltransform...

Using it as dataset is something as different..
create a new dataset and use readXML function to read into dataset .. there are some parameters about schema try different values for desired result..


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.