"Any ideas?" is the most frequently-asked question in technical forums. My answer is: yes.

Another postscript to QnD Excel-in-RS post

I have been really gratified by the feedback people have given me about my original post showing how to change sheet names in Reporting Services-driven Excel using XSLT. Lots of people have written to say thanks, and I appreciate it.

Not much feedback about my followup post, which tried to show how you can easily integrate transformations into more scenarios, pretty much no matter what environment you work in.  That's a pity -- it means people still think this is harder than it is.

So I thought I would share one more thing on this subject today...

I just had occasion to use this RS-Excel trick myself, for a colleague on my EC|Wise team.  FWIW I don't use XSLT mappers or anything visual when I code, it just isn't my style (no pun intended)... but I do use both XML Spy and Stylus Studio as IDEs, and they both have some pretty spiffy diagramming tools. 

Note to any Fox people reading: XML Spy generated the VFP-RDL diagrams you see in the helpfile under Using VFP Report Output XML. MS re did the images but for the life of me I can't see the difference from what I turned in.

Note for anybody reading and considering a purchase: other than that particular form of diagram, in my opinion Stylus Studio wins, hands-down.

So, anyway.  I decided to turn on Stylus Studio's XSLT mapper view, just for kicks.  It gave me a great way to show my team, and you, how little of the original Excel SSML has to be dynamically driven by the RS data XML export.  Most of the workbook you just copy directly from what your Excel example tells you it should look like.

Stylus Studio mapping for Excel from RS XML data export

Even the part you do have to dynamically drive isn't hard at all to do, as I hope my walkthrough showed.  The particular instance I did this morning had a number of wrinkles, including two tables and a number of grouping levels to be taken care of besides the one that explicitly determines page breaks.  (You can probably see that in the screen shot.)   It also happens to be a situation, alluded to in my walkthrough, where you have to be careful that your dynamically-driven tab names are actually legal tab names in Excel.  In this case, I used the following code to validate and change the tab names if necessary:

<xsl:template name="StripSheetName">
      <xsl:param name="item"/>
      <xsl:variable name="i1">
         <xsl:value-of select="translate($item,'&quot;“”','')"/>
      <xsl:value-of select="translate($i1,&quot;/\'&quot;,&quot;&quot;)"/>

... looks a bit wierd and it may not turn out to be sufficient, but basically all I'm doing is taking out characters I know to be illegal.  If I find more, I'll add more.

So this was sort of a gnarly case, with some extra work. But, even so, as I do this work, I really marvel at the cleanliness of the RS data export XML.  It makes things incredibly easy to do. 

You don't need to indulge in Muenchian grouping or anything weird to figure out how to handle subtotals and groups; it's all right there the way you most want it to be. I love that in a dialect.