r21211 - gnucash/trunk/contrib - contrib: add an XSLT style sheet to create an account list

Geert Janssens gjanssens at code.gnucash.org
Tue Aug 23 08:00:55 EDT 2011


Author: gjanssens
Date: 2011-08-23 08:00:54 -0400 (Tue, 23 Aug 2011)
New Revision: 21211
Trac: http://svn.gnucash.org/trac/changeset/21211

Added:
   gnucash/trunk/contrib/xslt/
   gnucash/trunk/contrib/xslt/acctlist.xsl
Log:
contrib: add an XSLT style sheet to create an account list

Add a simple XSLT style sheet that takes an (uncompressed) GnuCash
file or template, and generates a comma-separated list of account
numbers, names, and types.

Added: gnucash/trunk/contrib/xslt/acctlist.xsl
===================================================================
--- gnucash/trunk/contrib/xslt/acctlist.xsl	                        (rev 0)
+++ gnucash/trunk/contrib/xslt/acctlist.xsl	2011-08-23 12:00:54 UTC (rev 21211)
@@ -0,0 +1,41 @@
+<xsl:stylesheet version="1.0" 
+		xmlns="http://www.gnucash.org/XML/"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:gnc="http://www.gnucash.org/XML/gnc"
+		xmlns:act="http://www.gnucash.org/XML/act">
+  <xsl:output method="text" encoding="utf-8"/>
+  <xsl:strip-space elements="*"/>
+
+  <xsl:param name="separator">,</xsl:param>
+
+  <xsl:param name="quote">"</xsl:param>
+
+  <xsl:param name="newline">
</xsl:param>
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="gnc-v2|gnc:book|gnc-account-example">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="gnc:account">
+    <xsl:apply-templates select="act:code"/>
+    <xsl:value-of select="$separator"/>
+    <xsl:apply-templates select="act:name"/>
+    <xsl:value-of select="$separator"/>
+    <xsl:apply-templates select="act:type"/>
+    <xsl:text>
</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="act:code|act:name|act:type">
+    <xsl:value-of select="$quote"/>
+    <xsl:value-of select="."/>
+    <xsl:value-of select="$quote"/>
+  </xsl:template>
+
+  <xsl:template match="*"/>
+
+</xsl:stylesheet>
+  



More information about the gnucash-changes mailing list