Difference between revisions of "De/export to excel xls transform"
From GnuCash
m (syntaxhighlight) |
(Fix broken link) |
||
Line 1: | Line 1: | ||
− | Mehr dazu unter | + | Mehr dazu unter [http://xslfactory.free.fr/ XSL FACTORY: Gnucash2Gnumeric.xsl v0.6] |
<syntaxhighlight lang="XML"> | <syntaxhighlight lang="XML"> |
Latest revision as of 19:06, 12 March 2021
Mehr dazu unter XSL FACTORY: Gnucash2Gnumeric.xsl v0.6
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="0.6"
xmlns:gnc="http://www.gnucash.org/XML/gnc"
xmlns:act="http://www.gnucash.org/XML/act"
xmlns:book="http://www.gnucash.org/XML/book"
xmlns:cd="http://www.gnucash.org/XML/cd"
xmlns:cmdty="http://www.gnucash.org/XML/cmdty"
xmlns:price="http://www.gnucash.org/XML/price"
xmlns:slot="http://www.gnucash.org/XML/slot"
xmlns:split="http://www.gnucash.org/XML/split"
xmlns:sx="http://www.gnucash.org/XML/sx"
xmlns:trn="http://www.gnucash.org/XML/trn"
xmlns:ts="http://www.gnucash.org/XML/ts"
xmlns:fs="http://www.gnucash.org/XML/fs"
xmlns:bgt="http://www.gnucash.org/XML/bgt"
xmlns:recurrence="http://www.gnucash.org/XML/recurrence"
xmlns:lot="http://www.gnucash.org/XML/lot"
xmlns:cust="http://www.gnucash.org/XML/cust"
xmlns:job="http://www.gnucash.org/XML/job"
xmlns:addr="http://www.gnucash.org/XML/addr"
xmlns:owner="http://www.gnucash.org/XML/owner"
xmlns:taxtable="http://www.gnucash.org/XML/taxtable"
xmlns:tte="http://www.gnucash.org/XML/tte"
xmlns:employee="http://www.gnucash.org/XML/employee"
xmlns:order="http://www.gnucash.org/XML/order"
xmlns:billterm="http://www.gnucash.org/XML/billterm"
xmlns:bt-days="http://www.gnucash.org/XML/bt-days"
xmlns:bt-prox="http://www.gnucash.org/XML/bt-prox"
xmlns:invoice="http://www.gnucash.org/XML/invoice"
xmlns:entry="http://www.gnucash.org/XML/entry"
xmlns:vendor="http://www.gnucash.org/XML/vendor"
xmlns:gmr="http://www.gnumeric.org/v10.dtd"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
<!--
- GNUCASH_TO_GNUMERIC V0.6
-
- Copyright (c) 2002 Zach Garner (zach@neurosoft.org).
- 2003 Regis Leroy (lapagearegis@free.fr). All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
- 4. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
- CHANGELOG:
- 2003-September-9 : Regis Leroy : release of version 0.6 :
- * adding gnc:book to be 1.8.X compliant
- * removing unused data from output
- 2003-September-2 : Regis Leroy : release of version 0.5 :
- * changing namesaces to show real path to dtd
- * adding price namespace and removing the type one
- 2003-August-20 : Regis Leroy : release of version 0.4 :
- * better handling of line numbers in account sheets
- * adding code number info on accounts and on account sheets names
- * adding some style in output
- 2003-August-18 : Regis Leroy : release of version 0.3 :
- * handling sheets having the same name with numbers
- * adding one sheet by account containing his transactions
- * handling sheet index in gnumeric XML output
- * correcting number of lines for ACCOUNTS sheet
- * adding a DIARY sheet with all the transactions
- * adding all accounts's info on the account sheet
- * adding some gnucash's namespaces
- 2002 : Zach Garner : release of version 0.2 :
- * extraction of accounts from gnucash to gnumeric
- * understanding gnucash namespace bug
-
- TODO:
- * handling the more than 65 564 lines in gnumeric sheets
- * trying a OOo.org output
- * adding max rows info for sheets (done for the ACCOUNTS sheet only)
- * handling complete gnucash DTD (prices for example)
-
- USAGE:
- As far as we know gnucash XML files don't have a correct namespace
- definition, you have to correct it before transforming the file.
- replace <gnc-v2> in your XML gnucash file by theses lines:
<gnc-v2 xmlns:gnc="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/io-gncxml-version-2.dtd#gnc"
xmlns:cd="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/io-gncxml-version-2.dtd#cd"
xmlns:act="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/account-v2.dtdt#act"
xmlns:trn="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/transactions-v2.dtd#trn"
xmlns:split="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/transactions-v2.dtdt#split"
xmlns:cmdty="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/comodity-v2.dtd#cmdty"
xmlns:ts="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/types.dtd#ts"
xmlns:slots="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/types.dtd#slots"
xmlns:slot="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/types.dtd#slot"
xmlns:price="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/prices-v1.dtd#price"
xmlns:pricedb="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/prices-v1.dtd#pricedb"
xmlns:book="http://www.gnucash.org/lxr/gnucash/source/src/doc/xml/io-gncxml-version-2.dtd#book">
- Then you can use this stylesheet like that, for example:
* java org.apache.xalan.xslt.Process
* -IN gnucashfile -xsl thisfile.xsl -OUT gnumericfile.gnumeric
-->
<!-- ################# KEYS ################# -->
<xsl:key name="ACCOUNT_ID" match="gnc:account" use="act:id"/>
<xsl:key name="TRANSACTION_ACCOUNT_KEY" match="/gnc-v2/gnc:book/gnc:transaction/trn:splits/trn:split" use="split:account"/>
<!-- try to avoid strange names on sheets -->
<xsl:strip-space elements="act:Name gmr:SheetName gmr:Name"/>
<!-- ################# ATTRIBUTE SETS ################# -->
<xsl:attribute-set name="AccountSheetTransactionCell60">
<xsl:attribute name="ValueType">60</xsl:attribute>
<xsl:attribute name="Row"><xsl:value-of select="1+position()"/></xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="AccountSheetTransactionCell">
<xsl:attribute name="Row"><xsl:value-of select="1+position()"/></xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="AccountSheetCell">
<xsl:attribute name="ValueType">60</xsl:attribute>
<xsl:attribute name="Row">0</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="AccountCell">
<xsl:attribute name="ValueType">60</xsl:attribute>
<xsl:attribute name="Row"><xsl:number count="gnc:account" level="any"/></xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="TransactionCell60">
<xsl:attribute name="ValueType">60</xsl:attribute>
<xsl:attribute name="Row"><xsl:number count="gnc:transaction|trn:split" level="any"/></xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="TransactionCell">
<xsl:attribute name="Row"><xsl:number count="gnc:transaction|trn:split" level="any"/></xsl:attribute>
</xsl:attribute-set>
<!-- ################# ROOT ################# -->
<!-- make an xml sheet for gnumeric -->
<xsl:template match="/">
<xsl:message terminate="no">beginning in /</xsl:message>
<gmr:Workbook xmlns="http://www.gnumeric.org" xmlns:gmr="http://www.gnumeric.org/v10.dtd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gnumeric.org/v8.xsd">
<gmr:Attributes>
<gmr:Attribute>
<gmr:name>WorkbookView::show_horizontal_scrollbar</gmr:name>
<gmr:type>4</gmr:type>
<gmr:value>TRUE</gmr:value>
</gmr:Attribute>
<gmr:Attribute>
<gmr:name>WorkbookView::show_vertical_scrollbar</gmr:name>
<gmr:type>4</gmr:type>
<gmr:value>TRUE</gmr:value>
</gmr:Attribute>
<gmr:Attribute>
<gmr:name>WorkbookView::show_notebook_tabs</gmr:name>
<gmr:type>4</gmr:type>
<gmr:value>TRUE</gmr:value>
</gmr:Attribute>
<gmr:Attribute>
<gmr:name>WorkbookView::do_auto_completion</gmr:name>
<gmr:type>4</gmr:type>
<gmr:value>TRUE</gmr:value>
</gmr:Attribute>
</gmr:Attributes>
<gmr:Summary>
<gmr:Item>
<gmr:name>application</gmr:name>
<gmr:val-string>gnumeric</gmr:val-string>
</gmr:Item>
<gmr:Item>
<gmr:name>author</gmr:name>
<gmr:val-string>gnucash_to_gnumeric.xsl</gmr:val-string>
</gmr:Item>
</gmr:Summary>
<gmr:SheetNameIndex>
<!-- 2 sheets we know **********************************************-->
<gmr:SheetName>ACCOUNTS</gmr:SheetName>
<gmr:SheetName>DIARY</gmr:SheetName>
<!-- here are the other sheet, one for each account ****************-->
<xsl:apply-templates mode="ACCOUNT_INDEX_MODE"/>
</gmr:SheetNameIndex>
<gmr:Names/>
<gmr:Geometry Width="734" Height="426"/>
<gmr:Sheets>
<!--First sheet, the accounts sheet ***********************************-->
<gmr:Sheet DisplayFormulas="false" HideZero="false" HideGrid="false" HideColHeader="false" HideRowHeader="false" DisplayOutlines="true" OutlineSymbolsBelow="true" OutlineSymbolsRight="true">
<gmr:Name>ACCOUNTS</gmr:Name>
<gmr:MaxCol>7</gmr:MaxCol>
<xsl:apply-templates mode="MAX_ROW_MODE"/>
<xsl:element name="gmr:Maxrow"><xsl:value-of select="gnc:count-data[@cd:type='account']"/></xsl:element>
<gmr:Zoom>1.000000</gmr:Zoom>
<gmr:Names/>
<gmr:PrintInformation>
<gmr:Margins>
<gmr:top Points="28" PrefUnit="cm"/>
<gmr:bottom Points="28" PrefUnit="cm"/>
<gmr:left Points="28" PrefUnit="cm"/>
<gmr:right Points="28" PrefUnit="cm"/>
<gmr:header Points="14" PrefUnit="cm"/>
<gmr:footer Points="14" PrefUnit="cm"/>
</gmr:Margins>
<gmr:Scale type="percentage" percentage="100"/>
<gmr:vcenter value="0"/>
<gmr:hcenter value="0"/>
<gmr:grid value="0"/>
<gmr:even_if_only_styles value="0"/>
<gmr:monochrome value="0"/>
<gmr:draft value="0"/>
<gmr:titles value="0"/>
<gmr:repeat_top value=""/>
<gmr:repeat_left value=""/>
<gmr:order>r_then_d</gmr:order>
<gmr:orientation>landscape</gmr:orientation>
<gmr:Header Left="" Middle="&[TAB]" Right=""/>
<gmr:Footer Left="" Middle="Page &[PAGE]" Right=""/>
<gmr:paper>A4</gmr:paper>
</gmr:PrintInformation>
<gmr:Styles>
<gmr:StyleRegion startCol="8" startRow="1" endCol="8" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="1" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="8" startRow="0" endCol="8" endRow="0">
<gmr:Style HAlign="1" VAlign="2" WrapText="1" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="1" Italic="1" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="0" startRow="0" endCol="7" endRow="0">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="1" Italic="1" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="0" startRow="1" endCol="7" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="9" startRow="0" endCol="255" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
</gmr:Styles>
<gmr:Cols DefaultSizePts="48">
<gmr:ColInfo No="0" Unit="48" MarginA="2" MarginB="2" Count="2"/>
</gmr:Cols>
<gmr:Rows DefaultSizePts="12.8">
<gmr:RowInfo No="0" Unit="12.8" MarginA="1" MarginB="0"/>
<gmr:RowInfo No="1" Unit="12.8" MarginA="0" MarginB="0" Count="7"/>
</gmr:Rows>
<gmr:Selections CursorCol="0" CursorRow="1">
<gmr:Selection startCol="0" startRow="1" endCol="0" endRow="1"/>
</gmr:Selections>
<gmr:Cells>
<xsl:apply-templates mode="ACCOUNT_MODE"/>
</gmr:Cells>
<gmr:SheetLayout TopLeft="A1"/>
<gmr:Solver TargetCol="-1" TargetRow="-1" ProblemType="1" Inputs=""/>
</gmr:Sheet>
<!--Second sheet, the Diary sheet **************************************-->
<gmr:Sheet DisplayFormulas="false" HideZero="false" HideGrid="false" HideColHeader="false" HideRowHeader="false" DisplayOutlines="true" OutlineSymbolsBelow="true" OutlineSymbolsRight="true">
<gmr:Name>DIARY</gmr:Name>
<gmr:MaxCol>0</gmr:MaxCol>
<gmr:MaxRow>0</gmr:MaxRow>
<gmr:Zoom>1.000000</gmr:Zoom>
<gmr:Names/>
<gmr:PrintInformation>
<gmr:Margins>
<gmr:top Points="28" PrefUnit="cm"/>
<gmr:bottom Points="28" PrefUnit="cm"/>
<gmr:left Points="28" PrefUnit="cm"/>
<gmr:right Points="28" PrefUnit="cm"/>
<gmr:header Points="14" PrefUnit="cm"/>
<gmr:footer Points="14" PrefUnit="cm"/>
</gmr:Margins>
<gmr:Scale type="percentage" percentage="100"/>
<gmr:vcenter value="0"/>
<gmr:hcenter value="0"/>
<gmr:grid value="0"/>
<gmr:even_if_only_styles value="0"/>
<gmr:monochrome value="0"/>
<gmr:draft value="0"/>
<gmr:titles value="0"/>
<gmr:repeat_top value=""/>
<gmr:repeat_left value=""/>
<gmr:order>r_then_d</gmr:order>
<gmr:orientation>landscape</gmr:orientation>
<gmr:Header Left="" Middle="&[TAB]" Right=""/>
<gmr:Footer Left="" Middle="Page &[PAGE]" Right=""/>
<gmr:paper>A4</gmr:paper>
</gmr:PrintInformation>
<gmr:Styles>
<gmr:StyleRegion startCol="0" startRow="0" endCol="8" endRow="0">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="1" Italic="1" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="0" startRow="1" endCol="8" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="9" startRow="0" endCol="255" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
</gmr:Styles>
<gmr:Cols DefaultSizePts="48">
<gmr:ColInfo No="0" Unit="82.5" MarginA="2" MarginB="2" HardSize="1"/>
</gmr:Cols>
<gmr:Rows DefaultSizePts="12.8">
<gmr:RowInfo No="0" Unit="12.8" MarginA="1" MarginB="0"/>
</gmr:Rows>
<gmr:Selections CursorCol="0" CursorRow="1">
<gmr:Selection startCol="0" startRow="1" endCol="0" endRow="1"/>
</gmr:Selections>
<gmr:Cells>
<xsl:apply-templates mode="DIARY_MODE"/>
</gmr:Cells>
<gmr:SheetLayout TopLeft="A1"/>
<gmr:Solver TargetCol="-1" TargetRow="-1" ProblemType="1" Inputs=""/>
</gmr:Sheet>
<!--All the other sheets, accounts sheets ****************************-->
<xsl:apply-templates mode="ACCOUNT_SHEET_MODE"/>
</gmr:Sheets>
<gmr:UIData SelectedTab="1"/>
</gmr:Workbook>
</xsl:template>
<!-- End of the gnumeric xml doc, now starting xsl stuff-->
<!-- ################# ACCOUNT MODE ################# -->
<xsl:template match="gnc-v2" mode="ACCOUNT_MODE">
<xsl:message terminate="no">gnc-v2 - ACCOUNT_MODE</xsl:message>
<xsl:apply-templates mode="ACCOUNT_MODE"/>
</xsl:template>
<xsl:template match="gnc:book" mode="ACCOUNT_MODE">
<xsl:message terminate="no">gnc:book - ACCOUNT_MODE</xsl:message>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="0" ValueType="60">Id</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="1" ValueType="60">Code</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="2" ValueType="60">Type</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="3" ValueType="60">Name</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="4" ValueType="60">Description</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="5" ValueType="60">Parent</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="6" ValueType="60">Currency Id</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="7" ValueType="60">Currency-Scu</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="8" ValueType="60">Others</gmr:Cell>
<xsl:apply-templates mode="ACCOUNT_MODE"/>
</xsl:template>
<xsl:template match="gnc:count-data[@cd:type='book']" mode="ACCOUNT_MODE">
<xsl:message terminate="no">gnc:count-data - BOOK</xsl:message>
</xsl:template>
<xsl:template match="gnc:count-data[@cd:type='transaction']" mode="ACCOUNT_MODE"></xsl:template>
<xsl:template match="gnc:count-data[@cd:type='account']" mode="ACCOUNT_MODE"></xsl:template>
<xsl:template match="pricedb" mode="ACCOUNT_MODE">
<xsl:message terminate="no">__pricedb__v1 </xsl:message>
<xsl:apply-templates mode="ACCOUNT_MODE"/>
</xsl:template>
<xsl:template match="gnc:account[@version='2.0.0']" mode="ACCOUNT_MODE">
<xsl:message terminate="no">gnc:account - ACCOUNT <xsl:value-of select="act:name"/></xsl:message>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">0</xsl:attribute><xsl:value-of select="act:id"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">1</xsl:attribute><xsl:value-of select="act:code"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">2</xsl:attribute><xsl:value-of select="act:type"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">3</xsl:attribute><xsl:value-of select="act:name"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">4</xsl:attribute><xsl:value-of select="act:description"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">5</xsl:attribute><xsl:value-of select="key('ACCOUNT_ID',act:parent)/act:name"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">6</xsl:attribute><xsl:value-of select="act:currency/cmdty:space"/>-<xsl:value-of select="act:currency/cmdty:id"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">7</xsl:attribute><xsl:value-of select="act:currency-scu"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountCell">
<xsl:attribute name="Col">8</xsl:attribute>
<xsl:for-each select="act:slots/slot">
<xsl:value-of select="slot:key"/>::<xsl:value-of select="slot:value"/>|
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="gnc:transaction" mode="ACCOUNT_MODE"></xsl:template>
<xsl:template match="text() | @*" mode="ACCOUNT_MODE"></xsl:template>
<!-- ################# ACCOUNT SHEET MODE ################ -->
<xsl:template match="gnc-v2/gnc:book" mode="ACCOUNT_SHEET_MODE">
<xsl:message terminate="no">gnc-v2 - ACCOUNT SHEET</xsl:message>
<xsl:apply-templates mode="ACCOUNT_SHEET_MODE"/>
</xsl:template>
<xsl:template match="gnc:account" mode="ACCOUNT_SHEET_MODE">
<xsl:message terminate="no">gnc:account - ACCOUNT_SHEET <xsl:value-of select="act:name"/></xsl:message>
<gmr:Sheet DisplayFormulas="false" HideZero="false" HideGrid="false" HideColHeader="false" HideRowHeader="false" DisplayOutlines="true" OutlineSymbolsBelow="true" OutlineSymbolsRight="true">
<xsl:element name="gmr:Name">
<xsl:number count="gnc:account" level="any"/>_<xsl:value-of select="act:code"/>_<xsl:value-of select="act:name"/>
</xsl:element>
<gmr:MaxCol>0</gmr:MaxCol>
<gmr:MaxRow>0</gmr:MaxRow>
<gmr:Zoom>1.000000</gmr:Zoom>
<gmr:Names/>
<gmr:PrintInformation>
<gmr:Margins>
<gmr:top Points="28" PrefUnit="cm"/>
<gmr:bottom Points="28" PrefUnit="cm"/>
<gmr:left Points="28" PrefUnit="cm"/>
<gmr:right Points="28" PrefUnit="cm"/>
<gmr:header Points="14" PrefUnit="cm"/>
<gmr:footer Points="14" PrefUnit="cm"/>
</gmr:Margins>
<gmr:Scale type="percentage" percentage="100"/>
<gmr:vcenter value="0"/>
<gmr:hcenter value="0"/>
<gmr:grid value="0"/>
<gmr:even_if_only_styles value="0"/>
<gmr:monochrome value="0"/>
<gmr:draft value="0"/>
<gmr:titles value="0"/>
<gmr:repeat_top value=""/>
<gmr:repeat_left value=""/>
<gmr:order>r_then_d</gmr:order>
<gmr:orientation>landscape</gmr:orientation>
<gmr:Header Left="" Middle="&[TAB]" Right=""/>
<gmr:Footer Left="" Middle="Page &[PAGE]" Right=""/>
<gmr:paper>A4</gmr:paper>
</gmr:PrintInformation>
<gmr:Styles>
<gmr:StyleRegion startCol="0" startRow="0" endCol="5" endRow="0">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="1" Italic="1" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="6" startRow="0" endCol="255" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="0" startRow="1" endCol="7" endRow="1">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="1" Italic="1" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="8" startRow="1" endCol="255" endRow="1">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="0" startRow="2" endCol="7" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1" Color="0:0:0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="1" Color="0:0:0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startCol="8" startRow="2" endCol="255" endRow="65535">
<gmr:Style HAlign="1" VAlign="2" WrapText="0" Orient="1" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
<gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="0"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
</gmr:Styles>
<gmr:Cols DefaultSizePts="48">
<gmr:ColInfo No="0" Unit="82.5" MarginA="2" MarginB="2" HardSize="1"/>
</gmr:Cols>
<gmr:Rows DefaultSizePts="12.8">
<gmr:RowInfo No="0" Unit="12.8" MarginA="1" MarginB="0"/>
</gmr:Rows>
<gmr:Selections CursorCol="0" CursorRow="1">
<gmr:Selection startCol="0" startRow="1" endCol="0" endRow="1"/>
</gmr:Selections>
<gmr:Cells>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetCell">
<xsl:attribute name="Col">0</xsl:attribute>name: <xsl:value-of select="act:name"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetCell">
<xsl:attribute name="Col">1</xsl:attribute>type: <xsl:value-of select="act:type"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetCell">
<xsl:attribute name="Col">2</xsl:attribute>description: <xsl:value-of select="act:description"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetCell">
<xsl:attribute name="Col">3</xsl:attribute>parent name: <xsl:value-of select="key('ACCOUNT_ID',act:parent)/act:name"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetCell">
<xsl:attribute name="Col">4</xsl:attribute>cmdty id: <xsl:value-of select="act:currency/cmdty:id"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetCell">
<xsl:attribute name="Col">5</xsl:attribute>currency-scu: <xsl:value-of select="act:currency-scu"/></xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">0</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>transaction Id</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">1</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Date Posted</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">2</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Date Entered</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">3</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Description</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">4</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Value</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">5</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Quantity</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">6</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Reconciled State</xsl:element>
<xsl:element name="gmr:Cell">
<xsl:attribute name="Col">7</xsl:attribute><xsl:attribute name="Row">1</xsl:attribute>Reconciled Date</xsl:element>
<xsl:variable name="mytransaclist" select="key('TRANSACTION_ACCOUNT_KEY',act:id)"/>
<xsl:for-each select="$mytransaclist">
<xsl:sort select="substring(../../trn:date-posted/ts:date,1,19)"/>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell60">
<xsl:attribute name="Col">0</xsl:attribute><xsl:value-of select="../../trn:id"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell60">
<xsl:attribute name="Col">1</xsl:attribute><xsl:value-of select="substring(../../trn:date-posted/ts:date,1,19)"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell60">
<xsl:attribute name="Col">2</xsl:attribute><xsl:value-of select="substring(../../trn:date-entered/ts:date,1,19)"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell60">
<xsl:attribute name="Col">3</xsl:attribute><xsl:value-of select="../../trn:description"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell">
<xsl:attribute name="Col">4</xsl:attribute>=<xsl:value-of select="split:value"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell">
<xsl:attribute name="Col">5</xsl:attribute>=<xsl:value-of select="split:quantity"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell60">
<xsl:attribute name="Col">6</xsl:attribute><xsl:value-of select="split:reconciled-state"/></xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="AccountSheetTransactionCell60">
<xsl:attribute name="Col">7</xsl:attribute><xsl:value-of select="substring(split:reconcile-date/ts:date,1,19)"/></xsl:element>
</xsl:for-each>
</gmr:Cells>
<gmr:SheetLayout TopLeft="A1"/>
<gmr:Solver TargetCol="-1" TargetRow="-1" ProblemType="1" Inputs=""/>
</gmr:Sheet>
</xsl:template>
<xsl:template match="gnc:count-data" mode="ACCOUNT_SHEET_MODE"></xsl:template>
<xsl:template match="gnc:transaction" mode="ACCOUNT_SHEET_MODE"></xsl:template>
<xsl:template match="text() | @*" mode="ACCOUNT_SHEET_MODE"></xsl:template>
<!-- ################# MAX ROW MODE ############ -->
<xsl:template match="//gnc-v2/gnc:book/gnc:account" mode="MAX_ROW_MODE"></xsl:template>
<xsl:template match="gnc:count-data[@cd:type='account']" mode="MAX_ROW_MODE">
<xsl:element name="gmr:Maxrow">
<xsl:value-of select="gnc:count-data"/>
<xsl:apply-templates mode="MAX_ROW_MODE"/>
</xsl:element></xsl:template>
<xsl:template match="gnc:count-data[@cd:type='transaction']" mode="MAX_ROW_MODE"></xsl:template>
<xsl:template match="gnc:transaction" mode="MAX_ROW_MODE"></xsl:template>
<xsl:template match="text() | @*" mode="MAX_ROW_MODE"></xsl:template>
<!-- ################# ACCOUNT INDEX MODE ############ -->
<xsl:template match="//gnc-v2/gnc:book/gnc:account" mode="ACCOUNT_INDEX_MODE"><xsl:message terminate="no">gnc:account - ACCOUNT_SHEET_INDEX <xsl:value-of select="act:name"/></xsl:message>
<xsl:element name="gmr:SheetName"><xsl:number count="gnc:account" level="any"/>_<xsl:value-of select="act:code"/>_<xsl:value-of select="act:name"/></xsl:element>
</xsl:template>
<xsl:template match="gnc:count-data" mode="ACCOUNT_INDEX_MODE"></xsl:template>
<xsl:template match="gnc:transaction" mode="ACCOUNT_INDEX_MODE"></xsl:template>
<xsl:template match="text() | @*" mode="ACCOUNT_INDEX_MODE"></xsl:template>
<!-- ################## MODE DIARY ################ -->
<xsl:template match="gnc-v2/gnc:book" mode="DIARY_MODE">
<xsl:message terminate="no">gnc:book - DIARY</xsl:message>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="0" ValueType="60">Transaction Id</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="1" ValueType="60">Date Posted</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="2" ValueType="60">Date Entered</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="3" ValueType="60">Description</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="4" ValueType="60">Valeur</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="5" ValueType="60">Quantity</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="6" ValueType="60">Account</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="7" ValueType="60">Reconciled State</gmr:Cell>
<gmr:Cell xmlns:gmr="http://www.gnumeric.org/v10.dtd" Row="0" Col="8" ValueType="60">Reconciled Date</gmr:Cell>
<xsl:apply-templates mode="DIARY_MODE"/>
</xsl:template>
<xsl:template match="gnc:count-data[@cd:type='account']" mode="DIARY_MODE"></xsl:template>
<xsl:template match="gnc:count-data[@cd:type='transaction']" mode="DIARY_MODE">
<xsl:message terminate="no">gnc:count-data - DIARY</xsl:message>
</xsl:template>
<xsl:template match="gnc:account" mode="DIARY_MODE"></xsl:template>
<xsl:template match="gnc:transaction" mode="DIARY_MODE">
<xsl:message terminate="no">gnc:transaction - DIARY <xsl:number level="any"/></xsl:message>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">0</xsl:attribute><xsl:value-of select="trn:id"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">1</xsl:attribute><xsl:value-of select="substring(trn:date-posted/ts:date,1,19)"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">2</xsl:attribute><xsl:value-of select="substring(trn:date-entered/ts:date,1,19)"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">3</xsl:attribute><xsl:value-of select="trn:description"/>
</xsl:element>
<xsl:for-each select="trn:splits/trn:split">
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell">
<xsl:attribute name="Col">4</xsl:attribute>=<xsl:value-of select="split:value"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell">
<xsl:attribute name="Col">5</xsl:attribute>=<xsl:value-of select="split:quantity"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">6</xsl:attribute><xsl:value-of select="key('ACCOUNT_ID',split:account)/act:name"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">7</xsl:attribute><xsl:value-of select="split:reconciled-state"/>
</xsl:element>
<xsl:element name="gmr:Cell" use-attribute-sets="TransactionCell60">
<xsl:attribute name="Col">8</xsl:attribute><xsl:value-of select="substring(split:reconcile-date/ts:date,1,19)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="text() | @*" mode="DIARY_MODE"></xsl:template>
</xsl:stylesheet>