-
Notifications
You must be signed in to change notification settings - Fork 11
Preparing first output
At first, you want to make sure that your installation is correct. Create your template.xsl file with following contents:
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="2012.engine.xsl" />
<xsl:template match="/">
<xsl:call-template name="generate_excel">
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>Then you should run this file with saxon processor. If you're not familiar, we have included a .bat file which contains the proper command:
cd step1\output
"C:\Program Files\Saxonica\SaxonHE9.4N\bin\Transform.exe" -warnings:recover -xsl:../blank.xslt -s:../data.xml
cd ..\..
There are several things going on, which we will cover in Under the hood chapter.
After processing the whole thing with saxon, you will have entire directory structure of your excel template created. Within there, you need to replace media/blank_picture.jpg with a correct file - saxon, by default, generates not-xml files as completely blank ones (and also screams about that, so you need to make it quiet by -warnings:recover switch.)
After replacing binaries with their proper counterparts, zip the contents and rename .zip to .xlsx . Then open the file and .. voila!
Now it's time for some showtime. Let's prepare your first and important include, which we use. Let's call it static.xsl . Into this file, we will create two variables:
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="asset_theme">
</xsl:variable>
<xsl:variable name="asset_styles">
</xsl:variable>
</xsl:stylesheet>Now the important parts:
- Copy & paste the contents of xl/theme/theme1.xml into
asset_themevariable, and - Copy & paste the contents of xl/styles.xml into
asset_stylesvariable, and - Sanitize the excel's bullshit urls at the end of the styles:
<extLst>
<ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
<x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/>
</ext>
<ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">
<x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/>
</ext>
</extLst>should turn into:
<extLst>
<ext xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
<xsl:attribute name="uri"><xsl:text>{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}</xsl:text></xsl:attribute>
<x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/>
</ext>
<ext xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">
<xsl:attribute name="uri"><xsl:text>{9260A510-F301-46a8-8635-F512D64BE5F5}</xsl:text></xsl:attribute>
<x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/>
</ext>
</extLst>Now let's go to the next chapter in order to populate some content.
