JWColby
jwcolby at colbyconsulting.com
Thu Feb 22 16:00:19 CST 2007
Eric, thanks for this. I just ran into "user expectations" in my own application so I guess I need to be a little more careful of my own expectations. The problem of course is how do I determine this data. Is there a "generator" somewhere that generates this style sheet? Is it then placed at the top of the xml file before the xml data? I am not attempting to generate a web page, it just happened that Windows decided that IE should display the file. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Thursday, February 22, 2007 4:52 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Using XML John, You need an XSL (stylesheet) in order to display the XML properly using a browser. Here's a sample... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <HTML> <HEAD> <STYLE> .HDR { background-color:bisque;font-weight:bold } </STYLE> </HEAD> <BODY> <TABLE> <COLGROUP WIDTH="100" ALIGN="CENTER"></COLGROUP> <COLGROUP WIDTH="200" ALIGN="LEFT"></COLGROUP> <COLGROUP WIDTH="200" ALIGN="LEFT"></COLGROUP> <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP> <COLGROUP WIDTH="100" ALIGN="LEFT"></COLGROUP> <TD CLASS="HDR">Customer ID</TD> <TD CLASS="HDR">Company</TD> <TD CLASS="HDR">Contact</TD> <TD CLASS="HDR">Country</TD> <TD CLASS="HDR">Phone</TD> <xsl:for-each select="NewDataSet/Table"> <TR> <TD><xsl:value-of select="CustomerID"/></TD> <TD><xsl:value-of select="CompanyName"/></TD> <TD><xsl:value-of select="ContactName"/></TD> <TD><xsl:value-of select="Country"/></TD> <TD><xsl:value-of select="Phone"/></TD> </TR> </xsl:for-each> </TABLE> </BODY> </HTML> </xsl:template> </xsl:stylesheet> Eric -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Thursday, February 22, 2007 1:40 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Using XML One of the things I try to do when my classes prepare reports to send off to my client's clients is to log the data sent. Doing this allows me to have a record of what was sent in case there is ever a dispute. The data is rarely if ever used but a nice security blanket if you will. One of the problems with doing this is simply that since the data is custom to that report, a custom table has to be created to hold the data. I have also taken to outputting the file in a dated format as well as the "generic name" that the client receives - with the date and time that the file was output. I was in the middle of trying to figure out how to do this "generically" (you know me, make it available always) when it suddenly occurred to me... why not create an XML file instead of (or in addition to) my dated file. The xml file could have the identical name as my dated file except that it would have an XML extension. The XML is supposed to be "a table" in text format (kinda). Unfortunately I was working in A2K ( the least common denominator at this specific client) so I stopped, opened the project in Access 2002, and added a couple of lines of code to my report generator, and voila, XML files. I had to modify my mclsRptName (holds all of the names of my reports plus text streams) to add an XML file spec string and property, and then Application.ExportXML acExportQuery, mRSP_QueryName, mclsRptName.pFileSpecXML and I had an XML report sitting in the directory along with the other files. Unfortunately, the XML file causes Windows Explorer to open to display it, and then displays the xml text, not tables. My question is, is there some sort of viewer that can display the data in tables? I mean for just browsing data, XML is hardly intuitive to the human mind. Also unfortunate of course is the OVERHEAD. Holy smoke batman, a 15 kbyte file turns into a 91 kbyte file. And finally, unfortunately, whereas my custom class knows how to use the same text stream object to write the date, the application.ExportXML simply writes the last query presented to the file name. since my files can be a header, detail and footer, the footer will be the only thing there if a footer is the last query presented, the detail will be the last thing if the detail query is the last query presented etc. IOW, no possibility AFAICT to APPEND xml files to each other, at least using the built in application method. I am jazzed though how easy it was to do the xml thing. I must say I expected Internet explorer to show me a table though, complete with field names at the top. Wouldn't ya think? John W. Colby Colby Consulting www.ColbyConsulting.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.18.3/697 - Release Date: 2/22/2007 11:55 AM -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com