|
<?xml version="1.0" encoding="UTF-8"?> |
|
|
|
<!-- The output of this XSLT is the MS Excel 2003-2004 XML File Format, simply open in Excel to utilize. --> |
|
<!-- This script was built in Oxygen and was tested on Saxon PE 9.8 --> |
|
|
|
<xsl:stylesheet |
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
xmlns:array="http://www.w3.org/2005/xpath-functions/array" |
|
xmlns:fn="http://www.w3.org/2005/xpath-functions" |
|
xmlns:local="urn:grmartin:locally-scoped-functions:01D92EAAG3HKHKARK5B3E0Z04Z" |
|
version="3.0" |
|
xmlns="urn:schemas-microsoft-com:office:spreadsheet" |
|
xmlns:o="urn:schemas-microsoft-com:office:office" |
|
xmlns:x="urn:schemas-microsoft-com:office:excel" |
|
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" |
|
xmlns:html="http://www.w3.org/TR/REC-html40" |
|
exclude-result-prefixes="array local fn"> |
|
<xsl:output indent="true" media-type="text/xml" encoding="UTF-8"/> |
|
|
|
<xsl:param name="input" select="'url to json file'"/> |
|
<xsl:variable name="jsonData" select="json-doc($input)"/> |
|
|
|
<xsl:template name="xsl:initial-template"> |
|
<xsl:variable name="numRows" select="array:size($jsonData?cards)+1"/> |
|
<xsl:processing-instruction name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction> |
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" |
|
xmlns:o="urn:schemas-microsoft-com:office:office" |
|
xmlns:x="urn:schemas-microsoft-com:office:excel" |
|
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" |
|
xmlns:html="http://www.w3.org/TR/REC-html40"> |
|
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> |
|
<Title>Trello Conversion for <xsl:value-of select="$input"/></Title> |
|
<Author>Glenn Martin</Author> |
|
<LastAuthor>Glenn Martin</LastAuthor> |
|
<Created><xsl:value-of select="fn:current-dateTime()"/></Created> |
|
<HyperlinkBase>https://trello.com/c/</HyperlinkBase> |
|
<Version>16.00</Version> |
|
</DocumentProperties> |
|
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> |
|
<AllowPNG/> |
|
</OfficeDocumentSettings> |
|
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> |
|
<WindowHeight>17440</WindowHeight> |
|
<WindowWidth>28040</WindowWidth> |
|
<WindowTopX>5180</WindowTopX> |
|
<WindowTopY>1860</WindowTopY> |
|
<ProtectStructure>False</ProtectStructure> |
|
<ProtectWindows>False</ProtectWindows> |
|
</ExcelWorkbook> |
|
<Styles> |
|
<Style ss:ID="Default" ss:Name="Normal"> |
|
<Alignment ss:Vertical="Bottom"/> |
|
<Borders/> |
|
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/> |
|
<Interior/> |
|
<NumberFormat/> |
|
<Protection/> |
|
</Style> |
|
<Style ss:ID="s67" ss:Name="Hyperlink"> |
|
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#0563C1" |
|
ss:Underline="Single"/> |
|
</Style> |
|
<Style ss:ID="s65"> |
|
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="14" ss:Color="#FFFFFF" |
|
ss:Bold="1"/> |
|
<Interior ss:Color="#000000" ss:Pattern="Solid"/> |
|
</Style> |
|
<Style ss:ID="s66"> |
|
<NumberFormat ss:Format="Short Date"/> |
|
</Style> |
|
<Style ss:ID="s70"> |
|
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/> |
|
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="14" ss:Color="#FFFFFF" |
|
ss:Bold="1"/> |
|
<Interior ss:Color="#000000" ss:Pattern="Solid"/> |
|
</Style> |
|
</Styles> |
|
<Worksheet ss:Name="Sheet1"> |
|
<Table ss:ExpandedColumnCount="8" ss:ExpandedRowCount="{$numRows}" x:FullColumns="1" |
|
x:FullRows="1" ss:DefaultColumnWidth="65" ss:DefaultRowHeight="16"> |
|
<Column ss:Index="2" ss:AutoFitWidth="0" ss:Width="270"/> |
|
<Column ss:Index="4" ss:AutoFitWidth="0" ss:Width="270"/> |
|
<Column ss:Width="86"/> |
|
<Column ss:Width="124"/> |
|
<Row ss:Height="19" ss:StyleID="s65"> |
|
<Cell><Data ss:Type="String">ID</Data></Cell> |
|
<Cell><Data ss:Type="String">Name</Data></Cell> |
|
<Cell><Data ss:Type="String">Status</Data></Cell> |
|
<Cell><Data ss:Type="String">Description</Data></Cell> |
|
<Cell><Data ss:Type="String">Last Updated</Data></Cell> |
|
<Cell><Data ss:Type="String">Link</Data></Cell> |
|
<Cell ss:MergeAcross="1" ss:StyleID="s70"><Data ss:Type="String">Estimate</Data></Cell> |
|
</Row> |
|
<xsl:apply-templates select="$jsonData?cards"/> |
|
</Table> |
|
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> |
|
<PageSetup> |
|
<Header x:Margin="0.3"/> |
|
<Footer x:Margin="0.3"/> |
|
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/> |
|
</PageSetup> |
|
<Selected/> |
|
<Panes> |
|
<Pane> |
|
<Number>3</Number> |
|
<ActiveRow>1</ActiveRow> |
|
<ActiveCol>5</ActiveCol> |
|
</Pane> |
|
</Panes> |
|
<ProtectObjects>False</ProtectObjects> |
|
<ProtectScenarios>False</ProtectScenarios> |
|
</WorksheetOptions> |
|
</Worksheet> |
|
</Workbook> |
|
|
|
</xsl:template> |
|
|
|
<xsl:template match=".[. instance of map(*)]"> |
|
<xsl:variable name="listId" select="?idList"/> |
|
<xsl:variable name="listName" select="array:head(array:filter($jsonData?lists, function($x) {$x instance of map(*) and $x?id eq $listId}))?name"/> |
|
<Row> |
|
<Cell><Data ss:Type="String"><xsl:value-of select="?id"/></Data></Cell> |
|
<Cell><Data ss:Type="String"><xsl:value-of select="?name"/></Data></Cell> |
|
<Cell><Data ss:Type="String"><xsl:comment select="$listId"/><xsl:value-of select="$listName" disable-output-escaping="false"/></Data></Cell> |
|
<Cell><Data ss:Type="String"><xsl:value-of select="local:cdataIt(?desc)" disable-output-escaping="true"/></Data></Cell> |
|
<Cell ss:StyleID="s66"><Data ss:Type="DateTime"><xsl:value-of select="?dateLastActivity"/></Data></Cell> |
|
<Cell ss:StyleID="s67" ss:HRef="{?url}" |
|
x:HRefScreenTip="URL for {?id}"><Data ss:Type="String">Ticket Link</Data></Cell> |
|
<Cell><Data ss:Type="Number"><!-- To be filled by developers after xform -->0</Data></Cell> |
|
<Cell><Data ss:Type="Number"><!-- To be filled by developers after xform -->0</Data></Cell> |
|
</Row> |
|
</xsl:template> |
|
|
|
<xsl:function name="local:cdataIt"> |
|
<xsl:param name="inner"/> |
|
<xsl:text disable-output-escaping="true"><</xsl:text> |
|
<xsl:value-of select="concat('![','CDATA[', $inner, ']]')" disable-output-escaping="true" /> |
|
<xsl:text disable-output-escaping="true">></xsl:text> |
|
</xsl:function> |
|
</xsl:stylesheet> |