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

Subject: RE: [xsl] Producing Excel 2000 htm files: how do I manage the hidden stuff
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Tue, 02 May 2006 17:12:06 +0100
Charles

I may have missed something in your post but if you need commented output why can't you use the xsl:comment element?

--

Joe


From: cknell@xxxxxxxxxx
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Producing Excel 2000 htm files: how do I manage the hidden stuff
Date: Tue, 02 May 2006 12:04:47 -0400


I have a task to produce files for Excel 2000 from XML documents returned from a database query.

I started by saving a typical Excel file to a .htm file and began modifying it to produce an XSLT stylesheet. For the most part, this has not been a challenge. For the most part. But now comes the PITA (and that's not greek flatbread).

Round one:
Excel codes it's html style element by surrounding the content with comment markers (i.e., &lt;-- --&gt;). So my first thought was to enclose the content of the style element within a <xsl:text disable-output-escaping="yes"> element. But all that produced was an empty set of style tags (<style></style>).


Round two:
I decided to use the shameful <![CDATA[ ]]> markup. Well that produced what I was looking for between the opening and closing <style> tags, and the correct styling appeared in the document when view with MS-Excel.


But wait! There's more! (apologies to all non-U.S. residents who never saw a "Popeil" or "RONCO" ad on television).

Round three:
Just below the <style> section, and still in the <head> section, Excel places an XML document which gives additional information used when the file is viewed by Excel rather than with a browser. When left in the stylesheet "bare", that is to say without remarking it out in some way, the markup appears in the top, left-most cell of the Excel spreadsheet. Since the point of this exercise was to produce an Excel document that would require no further editing, deleting the cell's contents manually is not an option.


Round four:
So I tried to cause a set of HTML/XML comment delimitters to appear around this piece of markup, but to no avail. What worked for the <style> contents (enclosing it in !<[CDATA[ ]]>) caused all the angle brackets in the XML markup to appear as escaped characters.


Round five:
I next tried to place the whole XML document inside an <xsl:text disable-output-escaping="yes"> set of tags, but that caused Saxon's sax parser to object to character markup that was not well-formed.


Round six:
I next tried to enclose only the comment delimitters in <$[cdata[ ]]> elements. See the paragraph immediately above.


I think I've worn him out punching me. I need just one little trick to knock him out, but I'm out of ideas

Thanks for sticking with me so far. Now you know what I've done and a variety of things that don't work. Any suggestions?



--
Charles Knell
cknell@xxxxxxxxxx - email

Current Thread