Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Convert XMl to Excel using XLST >Thread Next - Re: Convert XMl to Excel using XLST Re: Convert XMl to Excel using XLSTTo: NULL Date: 1/9/2006 11:33:00 PM Here is quick & dirty XSLT that does the barebones stuff of translating the XML you provided into Excel, into 2 workSheets. You should be able to add all the bells & whistles using info from the XML for Spreadsheet reference and knowledge of XSLT. Hope this helps. Good luck <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <xsl:template match="/"> <xsl:processing-instruction name="mso-application"> <xsl:text>progid="Excel.Sheet"</xsl:text> </xsl:processing-instruction> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <Worksheet ss:Name="Sheet1"> <Table> <xsl:for-each select="AreasRoot//room/item"> <Row> <xsl:for-each select="*"> <Cell> <Data ss:Type="String"> <xsl:value-of select="."/> </Data> </Cell> </xsl:for-each> </Row> </xsl:for-each> </Table> </Worksheet> <Worksheet ss:Name="Sheet2"> <Table> <xsl:for-each select="AreasRoot/userDetails"> <Row> <xsl:for-each select="tennant/@*"> <Cell> <Data ss:Type="String"> <xsl:value-of select="."/> </Data> </Cell> </xsl:for-each> </Row> </xsl:for-each> </Table> </Worksheet> </Workbook> </xsl:template> </xsl:stylesheet> -- Naraendira Kumar R.R. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Kram" <mark.macumber@g...> wrote in message news:1136843395.598800.111960@f...... > sure, that would be fantastic. Thanks heaps. > > What Ill do is post the XML that the dataset read's in using the > DataSet.ReadXML() method. Then you can just create a XML file, and use > a dataset to read in the XMl file. That way you can have a play around > with it. > > here is the XML: (Some of it, its quite large) > > <?xml version="1.0" encoding="utf-8" ?> > <AreasRoot> > <room name="Entrance Hall"> > <item name="Doors"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Security Door"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Walls"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Windows"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Blinds/Curtains"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Ceiling"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Light Fittings"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Floor Coverings"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Power Points"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Built in Cupboard"> > <roomIndex>0</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > </room> > <room name="Lounge Room"> > <item name="Doors"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Walls"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Windows/Screens"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Blinds/Curtains"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Ceiling"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Light Fittings"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Floor Coverings"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="TV Point"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Power Points"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Heating"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="A/C Unit"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Built in Cupboard"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > <item name="Telephone"> > <roomIndex>1</roomIndex> > <conditionBefore></conditionBefore> > <conditionAfter></conditionAfter> > <commentsBefore></commentsBefore> > <commentsAfter></commentsAfter> > </item> > </room> > <userDetails> > <tennant > address="" > name="" > landlord="" > leaseDate="" > ></tennant> > </userDetails> > </AreasRoot> > > > > > > > Thanks again, if you can get this working I will be very grateful! > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
