<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Shouln'd this kind of work go to the wiki? There will surly be more<br>
people intrested in.<br>
<br>
Regards<br>
<br>
Andreas.<br>
<br>
Larry Evans wrote:<br>
<br>
<span style="white-space: pre;">> On 09/05/2003 01:14 AM, Matthew
Vanecek wrote:<br>
> <br>
>> I've written a simple XSLT transformation for the Gnucash
XML <br>
>> file. It spits out an HTML file with a 4-column table,
"Account<br>
>> Name", "Date Entered", "Number", "Descriptions", "Value". The<br>
>> "Value" column values are preceded by an '='. This makes it
easy<br>
>> to import into OOo Calc, due to the way values are stored in
our<br>
>> XML file.<br>
> <br>
> <br>
> Thanks Matthew,<br>
> <br>
> I've modified it to create a set of tables for each investment.<br>
> Each table makes it fairly easy to calculate the average return
on<br>
> the investment. A simple modification of the stylesheet would
make<br>
> it ideal for use in gnumeric to do the actual calculations.<br>
> <br>
> The stylesheet is attached. Hopefully others will find it useful
<br>
> or modify it, like it did yours, to get exactly what they want.<br>
> <br>
> <br>
> <br>
>
----------------------------------------------------------------------<br>
> <br>
> <br>
> <?xml version="1.0"?><br>
> <br>
> <!-- Copyright (C) 2003 Matt Vanecek<br>
> <br>
> License is hereby granted to freely copy, modify, or distribute <br>
> this work under the terms of the GNU General Public License, as<br>
> found at <a class="moz-txt-link-freetext" href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>.<br>
> <br>
> ChangeLog: 2005-09-13 Larry Evans WHAT: 1) Downloaded from post
at:<br>
> <br>
> <br>
>
<a class="moz-txt-link-freetext" href="http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/10413">http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/10413</a><br>
> <br>
> and extracted .xsl file. 2) Renamed. 2005-09-18 Larry Evans
WHAT: <br>
> 1) Restricted accounts to those under "Investments" 2) Grouped<br>
> accounts so each one had transactions table. 3) Added second
table<br>
> for account information, including latest commodity price. WHY: <br>
> 1-3) To allow calculation of average return on investment for
each<br>
> investment from table information for that investment.<br>
> <br>
> --><br>
> <br>
> <xsl:stylesheet version="1.0"<br>
> xmlns:xsl=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/1999/XSL/Transform">"http://www.w3.org/1999/XSL/Transform"</a> <br>
> xmlns:gnc=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/gnc">"http://www.gnucash.org/XML/gnc"</a> <br>
> xmlns:cmdty=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/cmdty">"http://www.gnucash.org/XML/cmdty"</a> <br>
> xmlns:price=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/price">"http://www.gnucash.org/XML/price"</a> <br>
> xmlns:act=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/act">"http://www.gnucash.org/XML/act"</a> <br>
> xmlns:trn=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/trn">"http://www.gnucash.org/XML/trn"</a> <br>
> xmlns:split=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/split">"http://www.gnucash.org/XML/split"</a> <br>
> xmlns:ts=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/ts">"http://www.gnucash.org/XML/ts"</a> <br>
> xmlns:cust=<a class="moz-txt-link-rfc2396E" href="http://www.gnucash.org/XML/cust">"http://www.gnucash.org/XML/cust"</a><br>
> <br>
> <xsl:output method="html" indent="yes"
encoding="ISO-8859-1"/><br>
> <br>
> <xsl:template match="//gnc-v2/gnc:book"> <html> <br>
> <head><title>Finances
File</title></head> <body><br>
> <br>
> <xsl:variable name="investments_id"> <xsl:value-of<br>
> select="gnc:account[act:name='Investments']/act:id"/> <br>
> </xsl:variable><br>
> <br>
> <xsl:for-each select="gnc:account"> <xsl:sort
select="act:name"/> <br>
> <!-- Only select Investments accounts --> <xsl:if<br>
> test="$investments_id=act:parent"><br>
> <br>
> <xsl:variable name="act_id"> <xsl:value-of
select="act:id"/> <br>
> </xsl:variable><br>
> <br>
> <xsl:variable name="cmdty_id"> <xsl:value-of<br>
> select="act:commodity/cmdty:id"/> </xsl:variable><br>
> <br>
> <table border="1"> <caption>account
information</caption><br>
> <br>
> <th>name</th> <th>commodity</th>
<th>Value</th> <th>on date</th> <br>
> <tr> <td><xsl:value-of
select="act:name"/></td> <td><xsl:value-of<br>
> select="$cmdty_id"/></td> <td><xsl:value-of
select= <br>
> "../gnc:pricedb/price [ price:type='last' and<br>
> price:commodity/cmdty:id=$cmdty_id ]/price:value " />
</td> <br>
> <td><xsl:value-of select= "../gnc:pricedb/price [<br>
> price:type='last' and price:commodity/cmdty:id=$cmdty_id <br>
> ]/price:time " /> </td> </tr> </table><br>
> <br>
> <table border="1"> <caption>account
transactions</caption><br>
> <br>
> <th>Date Posted</th>
<th>Description</th> <th>Value</th> <br>
> <th>Quantity</th><br>
> <br>
> <xsl:for-each select="../gnc:transaction"> <xsl:sort<br>
> select="trn:date-posted/ts:date"/><br>
> <br>
> <xsl:if test="$act_id =
trn:splits/trn:split/split:account"> <tr> <br>
> <td><xsl:value-of<br>
> select="substring(trn:date-posted/ts:date,1,10)"/></td>
<br>
> <td><xsl:value-of
select="trn:description"/></td> <br>
> <td>=<xsl:value-of
select="trn:splits/trn:split/split:value"/></td><br>
> <td>=<xsl:value-of<br>
> select="trn:splits/trn:split/split:quantity"/></td>
</tr> </xsl:if><br>
> </xsl:for-each><br>
> <br>
> </table> <HR size="5"/><br>
> <br>
> </xsl:if><br>
> <br>
> </xsl:for-each><br>
> <br>
> </body> </html> </xsl:template><br>
> <br>
> <!-- Root template - weed out the stuff we don't want --> <br>
> <xsl:template match="text() | @*"> </xsl:template><br>
> <br>
> </xsl:stylesheet><br>
> <br>
> <br>
>
----------------------------------------------------------------------<br>
> <br>
> <br>
> _______________________________________________ gnucash-devel<br>
> mailing list <a class="moz-txt-link-abbreviated" href="mailto:gnucash-devel@gnucash.org">gnucash-devel@gnucash.org</a> <br>
> <a class="moz-txt-link-freetext" href="https://lists.gnucash.org/mailman/listinfo/gnucash-devel">https://lists.gnucash.org/mailman/listinfo/gnucash-devel</a></span><br>
<br>
<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.1 (GNU/Linux)<br>
Comment: Using GnuPG with Thunderbird - <a class="moz-txt-link-freetext" href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a><br>
<br>
iD8DBQFDLmhUUmBtSMq5cGURAtkdAKCFi4vEGcRIGuQPpSnegY6lV56tEACgq6rl<br>
uJHjjHHTrEYYcWJGukNafos=<br>
=LLtf<br>
-----END PGP SIGNATURE-----<br>
<br>
</body>
</html>