Help dereconciling account using XSLT
Ben Pracht
bpracht at nc.rr.com
Fri Apr 8 01:44:58 EDT 2005
This may be OT, but hopefully someone will be nice and tell me that
special something I forgot....
I've recently had to add transactions to a credit card account which
occurred prior to previously reconciled transactions. I now want them
all to be reconciled, which should be mostly a matter of telling GnuCash
that none of them are reconciled, and let me go through the process again.
Since there doesn't seem to be an easy way of doing this, I'm resorting
to editing the XML file using XSLT. However, XSLT is fighting me and
won't listen to a specific template pattern that I want. When I can get
it to listen to my template, I'll remove the reconciliation date for
each transaction in that account and mark the reconciliation field with 'n'.
Here's my xsl file:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gnc="gnc_ns"
xmlns:trn="trn_ns" xmlns:split="split_ns" xmlns:cd="cd_ns"
xmlns:book="book_ns" xmlns:slot="slot_ns" xmlns:cmdty="cmdty_ns"
xmlns:act="act_ns" xmlns:ts="ts_ns" xmlns:sx="sx_ns" xmlns:fs="fs_ns"
xmlns:vendor="vendor_ns" xmlns:addr="addr_ns">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="//trn:split" priority="2">
<!-- Does not listen to this -->
<xsl:text>@@@@</xsl:text>
</xsl:template>
<!-- Copy over the regular elements -->
<xsl:template match="//*" priority="1">
<xsl:element name="{name(.)}">
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!-- Copy over the comments -->
<xsl:template match="//comment()" priority="1">
<xsl:comment>
<xsl:value-of select="."/>
</xsl:comment>
</xsl:template>
<!-- Copy over the processing instructions -->
<xsl:template match="//processing-instruction()" priority="1">
<xsl:processing-instruction name="{name()}">
<xsl:value-of select="."/>
</xsl:processing-instruction>
</xsl:template>
</xsl:stylesheet>
How can I get XSLT to listen to me? Ftw: I'm using Saxon. There's
about 3 years worth of transactions in this account. I'd really, really
hate to do this manually. I did it manually with Vim when I only had
about a year recorded, and it worked, but it was a pain. In otherwords,
I know what I'm doing with GnuCash, I guess I don't know enough about XSLT.
Thanks in advance,
Ben
More information about the gnucash-user
mailing list