Skip to content
Snippets Groups Projects
Commit c6db30991a0c authored by Olivier CAYROL's avatar Olivier CAYROL
Browse files

Added a stylesheet to render accounting XML

parent 3727402422b4
No related branches found
No related tags found
No related merge requests found
<?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>&lt;</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>&lt;/</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>></xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
......@@ -38,6 +38,8 @@
"""display a list of entities by calling their <item_vid> view
"""
self.w(u'<?xml version="1.0" encoding="%s"?>\n' % self.req.encoding)
self.w(u'<?xml-stylesheet href="%saccounting-entries.xsl" '
u'rel="stylesheet" type="text/xsl"?>\n' % self.req.datadir_url)
self.w(u'<ecritures>\n')
for i in xrange(self.rset.rowcount):
self.cell_call(i, 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment