<?xml version="1.0" encoding="ISO-8859-1"?>
<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/str.template.xsl"/>
<xsl:include href="xsl/formatFunctions.xsl"/>
<xsl:include href="xsl/accountingFormatFunction.xsl"/>
<!-- Main -->
<xsl:template match="/">
<output-format>
<content_type>text/plain</content_type>
<charset>ISO-8859-15</charset>
<file_prefix>Rimport_</file_prefix>
<file_extension>txt</file_extension>
<converter>ISO</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">
<!-- entry number -->
<xsl:value-of select="format-number($flow_id, '000000')"/>
<xsl:value-of select="$TAB"/>
<!-- paper on 2 strings -->
<xsl:call-template name="choose-paper">
<xsl:with-param name="flowAccounts" select="$accounts"/>
</xsl:call-template>
<xsl:value-of select="$TAB"/>
<!-- date on 10 strings -->
<xsl:call-template name="displayDate">
<xsl:with-param name="date">
<xsl:call-template name="dateTimeISO">
<xsl:with-param name="dateTime">
<xsl:value-of select="converted_account_date"/>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$TAB"/>
<!-- 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>
<xsl:value-of select="$TAB"/>
<!-- account name on 35 strings -->
<xsl:call-template name="accountExportName">
<xsl:with-param name="entry" select="account_entry"/>
<xsl:with-param name="size" select="35"/>
</xsl:call-template>
<xsl:value-of select="$TAB"/>
<!-- amount + 1 string D or C -->
<xsl:choose>
<xsl:when test="debit!=0">
<xsl:value-of select="format-number(debit,'0.00')"/>
<xsl:value-of select="$TAB"/>
<xsl:text>D</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="format-number(credit,'0.00')"/>
<xsl:value-of select="$TAB"/>
<xsl:text>C</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$TAB"/>
<!-- code status 1 strings, B = brouillard -->
<xsl:text>B</xsl:text>
<xsl:value-of select="$TAB"/>
<!-- label on 50 strings -->
<xsl:call-template name="format-text">
<xsl:with-param name="text">
<xsl:call-template name="str.characterRemover">
<xsl:with-param name="string2Clean">
<xsl:value-of select="comments"/>
<xsl:text> </xsl:text>
<xsl:value-of select="flight/comments"/>
</xsl:with-param>
<xsl:with-param name="character2Remove">
<xsl:text></xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="size" select="50"/>
</xsl:call-template>
<xsl:value-of select="$CR"/><xsl:value-of select="$LF"/>
</xsl:variable>
<xsl:value-of select="$line" disable-output-escaping="yes"/>
</xsl:template>
<xsl:template name="displayDate">
<xsl:param name="date"/>
<xsl:value-of select="substring($date,9,2)"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="substring($date,6,2)"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="substring($date,1,4)"/>
</xsl:template>
</xsl:stylesheet>