Accounting export template Sage
Revision as of 09:35, 18 September 2012 by Jcheng (Talk | contribs) (Created page with "<xml><?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" media-type="text/plain" ...")
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" media-type="text/plain" indent="no" standalone="yes" omit-xml-declaration="yes" encoding="ISO-8859-1"/> <xsl:strip-space elements="*"/> <xsl:include href="xsl/formatFunctions.xsl"/> <xsl:include href="xsl/accountingFormatFunction.xsl"/> <xsl:include href="xsl/reportFunction.xsl"/> <!-- Main --> <xsl:template match="/"> <output-format> <content_type>text/plain</content_type> <charset>ISO-8859-15</charset> <file_prefix>Import_</file_prefix> <file_extension>pnm</file_extension> <converter>ISOWithHeader</converter> </output-format> <xsl:apply-templates select="account_entrys/account_entry"> <xsl:sort select="@id" order="ascending" data-type="number"/> </xsl:apply-templates> </xsl:template> <!--show account line --> <xsl:template match="account_entry"> <xsl:variable name="flow_id" select="flow_id"/> <xsl:variable name="accounts" select="/account_entrys/account_entry[flow_id=$flow_id]/account/export_account"/> <xsl:variable name="line"> <!-- paper 3 strings --> <xsl:call-template name="choose-paper"> <xsl:with-param name="flowAccounts" select="$accounts"/> </xsl:call-template> <xsl:text> </xsl:text> <!-- date on 6 strings --> <xsl:call-template name="dateSage"> <xsl:with-param name="date"> <xsl:call-template name="dateTimeISO"> <xsl:with-param name="dateTime" select="converted_account_date"/> </xsl:call-template> </xsl:with-param> </xsl:call-template> <!-- type on 2 strings --> <xsl:text> </xsl:text> <!-- account number on 13 strings --> <xsl:call-template name="format-text"> <xsl:with-param name="text" select="account/export_account"/> <xsl:with-param name="size" select="13"/> </xsl:call-template> <!-- Account t ype on 1 string --> <xsl:text> </xsl:text> <!-- auxillary account on 13 strings --> <xsl:text> </xsl:text> <!-- transaction reference on 13 strings --> <xsl:call-template name="format-text"> <xsl:with-param name="text" select="@id"/> <xsl:with-param name="size" select="13"/> </xsl:call-template> <!-- transaction name on 25 strings --> <xsl:call-template name="accountExportName"> <xsl:with-param name="entry" select="account_entry"/> <xsl:with-param name="size" select="25"/> </xsl:call-template> <!-- Paiment mod on 1 string --> <xsl:text> </xsl:text> <!-- Due date on 6 strings --> <xsl:text> </xsl:text> <!-- amount on 1 string to write D or C + 20 strings, two digits --> <xsl:choose> <xsl:when test="debit!=0"> <xsl:text>D</xsl:text> <xsl:call-template name="replace-zero-head-by-white-space"> <xsl:with-param name="entry"> <xsl:value-of select="format-number(debit,'00000000000000000.00')"/> </xsl:with-param> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:text>C</xsl:text> <xsl:call-template name="replace-zero-head-by-white-space"> <xsl:with-param name="entry"> <xsl:value-of select="format-number(credit,'00000000000000000.00')"/> </xsl:with-param> </xsl:call-template> </xsl:otherwise> </xsl:choose> <!-- Transaction type on 1 string --> <xsl:text>N</xsl:text> <!-- Entry number on 7 strings --> <xsl:value-of select="format-number($flow_id, '0000000')"/> <!-- not used on 26 strings --> <xsl:text> </xsl:text> <xsl:value-of select="$CR"/><xsl:value-of select="$LF"/> </xsl:variable> <xsl:value-of select="$line" disable-output-escaping="yes"/> </xsl:template> </xsl:stylesheet>