diff --git a/data/accounting-entries.xsl b/data/accounting-entries.xsl new file mode 100644 index 0000000000000000000000000000000000000000..98eba9e700ede0b2ea864008aa5d6750749e6ff8_ZGF0YS9hY2NvdW50aW5nLWVudHJpZXMueHNs --- /dev/null +++ b/data/accounting-entries.xsl @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + <xsl:output method="text" encoding="UTF-8"/> + + <xsl:template match="*"> + <xsl:param name="indent" select="''"/> + + <xsl:call-template name="write-element"> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="ecriture"> + <xsl:param name="indent" select="''"/> + + <xsl:call-template name="write-element"> + <xsl:with-param name="indent" select="$indent"/> + </xsl:call-template> + <xsl:if test="following-sibling::ecriture"> + <xsl:text> +</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="@*"> + <xsl:text> </xsl:text> + <xsl:value-of select="name()"/> + <xsl:text>="</xsl:text> + <xsl:value-of select="."/> + <xsl:text>"</xsl:text> + </xsl:template> + + <xsl:template match="text()"> + <xsl:if test="normalize-space(.)"> + <xsl:value-of select="."/> + </xsl:if> + </xsl:template> + + <xsl:template name="write-element"> + <xsl:param name="indent" select="''"/> + + <xsl:text> +</xsl:text> + <xsl:value-of select="$indent"/> + <xsl:text><</xsl:text> + <xsl:value-of select="name()"/> + <xsl:apply-templates select="@*"> + <xsl:sort select="name()"/> + </xsl:apply-templates> + <xsl:if test="not(*|text())"> + <xsl:text>/</xsl:text> + </xsl:if> + <xsl:text>></xsl:text> + + <xsl:if test="*|text()"> + <xsl:apply-templates select="*|text()"> + <xsl:with-param name="indent" select="concat($indent,' ')"/> + </xsl:apply-templates> + + <xsl:if test="*"> + <xsl:text> +</xsl:text> + <xsl:value-of select="$indent"/> + </xsl:if> + <xsl:text></</xsl:text> + <xsl:value-of select="name()"/> + <xsl:text>></xsl:text> + </xsl:if> + </xsl:template> + +</xsl:stylesheet> diff --git a/views/accounting.py b/views/accounting.py index fbaa1e593b46f04f0fb5e62b7f26d44f7ec868a1_dmlld3MvYWNjb3VudGluZy5weQ==..98eba9e700ede0b2ea864008aa5d6750749e6ff8_dmlld3MvYWNjb3VudGluZy5weQ== 100644 --- a/views/accounting.py +++ b/views/accounting.py @@ -25,6 +25,8 @@ """display a list of entities by calling their <item_vid> view """ self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self._cw.encoding) + self.w(u'<?xml-stylesheet href="%saccounting-entries.xsl" ' + u'rel="stylesheet" type="text/xsl"?>\n' % self._cw.datadir_url) self.w(u'<ecritures>\n') for i in xrange(self.cw_rset.rowcount): self.cell_call(i, 0) @@ -49,6 +51,8 @@ """display a list of entities by calling their <item_vid> view """ self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self._cw.encoding) + self.w(u'<?xml-stylesheet href="%saccounting-entries.xsl" ' + u'rel="stylesheet" type="text/xsl"?>\n' % self._cw.datadir_url) self.w(u'<ecritures>\n') for i in xrange(self.cw_rset.rowcount): self.cell_call(i, 0)