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/6/2006 4:18:00 PM Seems like what you need is the target XML format. It is called XML for Spreadsheet. Here is the link to the reference. http://msdn.microsoft.com/library/en-us/dnexcl2k2/html/odc_xmlss.asp -Naraen "Joe Fawcett" <joefawcett@n...> wrote in message news:%23o5MpXdEGHA.3000@T...... > <mark.macumber@g...> wrote in message > news:1136435616.629914.33270@g...... >>I have been Scowering the net to try to find how to convert a simple >> XML file to an Excel workbook using XSLT. I have a basic outline >> working, But I need extra help. My XML is as follows: >> >> <?xml version="1.0"?> >> <?xml-stylesheet type='text/xsl' href='conditionReport.xslt'?> >> <AreasRoot> >> <room name="Entrance Hall"> >> <item name="Doors"> >> <roomIndex>0</roomIndex> >> <conditionBefore /> >> <conditionAfter /> >> <commentsBefore /> >> <commentsAfter /> >> </item> >> <item name="Security Door"> >> <roomIndex>0</roomIndex> >> <conditionBefore>F</conditionBefore> >> <conditionAfter /> >> <commentsBefore /> >> <commentsAfter /> >> </item> >> </room> >> >> <userDetails> >> <tennant address="123 Fake Street" >> name="Mark" >> landlord="DCK" >> leaseDate="11/11/2005" /> >> </userDetails> >> </AreasRoot> >> >> >> ********************************************************************************* >> End of XML - this is not part of the XML >> ********************************************************************************* >> >> and here is the XSLT document I use to format the above: (called >> conditionReport.xslt) >> >> <?xml version="1.0" encoding="UTF-8" ?> >> <xsl:stylesheet version="1.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >> <xsl:template match="/"> >> <html> >> <head> >> <style> >> >> </style> >> </head> >> <body> >> <table border="1"> >> <colgroup width="20" align="center"></colgroup> >> <colgroup width="135" align="left"></colgroup> >> <colgroup width="25" align="left"></colgroup> >> <colgroup width="25" align="left"></colgroup> >> <colgroup width="25" align="left"></colgroup> >> <colgroup width="250" align="left"></colgroup> >> <colgroup width="25" align="left"></colgroup> >> <colgroup width="25" align="left"></colgroup> >> <colgroup width="25" align="left"></colgroup> >> <colgroup width="250" align="left"></colgroup> >> <td>Room</td> >> <td>Item</td> >> <td>Good</td> >> <td>Fair</td> >> <td>Poor</td> >> <td>Other Items and Comments</td> >> <td>Good</td> >> <td>Fair</td> >> <td>Poor</td> >> <td>Other Items and Comments</td> >> <xsl:for-each select="AreasRoot/room"> >> <tr> >> <td valign="top" rowspan="{count(item)}" >> reference-orientation="90"> >> <b> >> <xsl:value-of select="@name"/> >> </b> >> </td> >> <xsl:for-each select="item"> >> <td> >> <xsl:value-of select="@name"/> >> </td> >> <td> >> <xsl:if test="./conditionBefore = 'G' "> >> x >> </xsl:if> >> </td> >> <td> >> <xsl:if test="./conditionBefore = 'F' "> >> x >> </xsl:if> >> </td> >> <td> >> <xsl:if test="./conditionBefore = 'P' "> >> x >> </xsl:if> >> </td> >> <td> >> <xsl:value-of select="commentsBefore"/> >> </td> >> <td> >> <xsl:if test="./conditionAfter = 'G' "> >> x >> </xsl:if> >> </td> >> <td> >> <xsl:if test="./conditionAfter = 'G' "> >> x >> </xsl:if> >> </td> >> <td> >> <xsl:if test="./conditionAfter = 'G' "> >> x >> </xsl:if> >> </td> >> <td> >> <xsl:value-of select="commentsAfter"/> >> </td> >> <xsl:if test="position() != last()"> >> <xsl:text disable-output-escaping="yes"><tr></xsl:text> >> </xsl:if> >> </xsl:for-each> >> </tr> >> </xsl:for-each> >> </table> >> </body> >> </html> >> </xsl:template> >> </xsl:stylesheet> >> >> >> **************************************************************************** >> End of XSLT document - this is not part of the XSLT document >> **************************************************************************** >> >> >> so that works ok so far. I need some basic formatting done, but that >> can be worried about at a leter date. As you can see in the XML there >> is a element called userDetails. I need for the information stored in >> this node the on a different worksheet, how do i do that? I just cant >> seem to find an answer anywhere its driving me nuts! >> >> Please help. >> Cheers, >> Mark >> > As far as I know you cannot create multi sheet workbooks using this > technique, after all you're not creating a workbook, just an HTML document > that Excel can read. > You might be able to do this if you create a proper Excel/XML document as > used by Excel 2003. If you have this version try saving a two sheet > workbook as XML and seeing if only one document is produced. > > You may also want to try the Microsoft.public.office.xml group. > > -- > > Joe Fawcett (MVP - XML) > > https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
