RE: Re: RE: [xsl] Producing Excel 2000 htm files: how do I manage the hidden stuff

Subject: RE: Re: RE: [xsl] Producing Excel 2000 htm files: how do I manage the hidden stuff
From: cknell@xxxxxxxxxx
Date: Tue, 02 May 2006 14:06:14 -0400
I would be only too happy to, if one were available. When I open an Excel file and choose File->Save As from the drop-down menu, I am presented with the following 31 format choices, none of which is XML:

Microsoft Excel Workbook (*.xls)
Web Page (*.htm;*.html)
Template (*.xlt)
Text(Tab elimitted)(*.txt)
Unicode Text (*.txt)
Microsoft Excel 5.0/95 Workbook (*.xls)
Microsoft Excel 97-2000 & 5.0/95 Workbook (*.xls)
CSV (Comma delimitted)(*.csv)
Microsoft Excel 4.0 Worksheet (*.xls)
Microsoft Excel 3.0 Worksheet (*.xls)
Microsoft Excel 2.1 Worksheet (*.xls)
Microsoft Excel 4.0 Workbook (*.xlw)
WK4 (1-2-3)(*.wk4)
WK3,FM3 (1-2-3)(*.wk3)
WK3 (1-2-3)(*.wk3)
WKS (*.wks)
WQ1 (Quattro Pro/DOS) (*.wq1)
DBF 4 (dBase IV)
DBF 3 (dbase III)
DBF 2 (dbase II)
Formatted Text (Space delmitted)(*.prn)
Text Macintosh (*.txt)
Text DOS (*.txt)
CSV Macintosh (*.csv)
CSV DOS (*.csv)
DIF (Data interchange format)(*.dif)
SYLK (Symbolic link)(*.slk)
Microsoft Excel Add-In (*.xla)

My version information for Excel says "9.0.06926-SP3". Which one of the file types enumerated in the list above gives me an XML file?
Charles Knell
cknell@xxxxxxxxxx - email

-----Original Message-----
From:     Jon Gorman <jonathan.gorman@xxxxxxxxx>
Sent:     Tue, 2 May 2006 12:39:06 -0500
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Re: RE: [xsl] Producing Excel 2000 htm files: how do I manage the hidden stuff

On 5/2/06, cknell@xxxxxxxxxx <cknell@xxxxxxxxxx> wrote:
> The direct answer is, "Because I didn't think of it." Having now tried it, I can tell you that it strips away all the XML markup from the document, leaving only the element contents.

It creates an comment, just like xsl:element.  The content of the
comment are determined by what the xsl:comment element contains. 
Remember that a comment doesn't contain markup (since it is after all,
just text).  So when you have a element somewhere in the template, it
returns just the text value.  (Just as if you evaluated an element as
a string elsewhere in XSLT).

If you want to complate the sin of inserting functionality in a
non-functional part of the xml document, you'll need to tell it what
text you want to output (ie the "looks like markup" but is not).

So one possible way of doing this would be something like:

 <xsl:template match="*" mode="insideComment">
     <xsl:text><</xsl:text><xsl:value-of select="name(.)"
<xsl:apply-templates />
<xsl:text></</xsl:text><xsl:value-of select="name(.)"

Of course, I wonder more:
1) Why not just do it in the Excel xml format if your target is Excel
2000.  I thought that was more well supported and documented for the
2000 version?

2) Why not use some other XML techniques (SAX or DOM) or libraries in
conjunction with XSLT to produce an Excel binary?  This is an approach
I find myself taking, but mostly because of a mixed user base who
might be still using versions of Excel earlier than 2000.

Jon Gorman

Current Thread