[thelist] XSLT XML output to XML
Jon Molesa
rjmolesa at consoltec.net
Sat Apr 14 11:03:07 CDT 2007
David,
Much appreciated. I'm reading through all the suggestions. I
posted over on comp.xml as well. Anyway, I'll be trying all these
shortly. I may have not been clear though. I'm only wanting to ignore
those transactions that have <slot:key>gncInvoice</slot:key>, not all
transaction with a slot:key.
Thanks again. Hopefully I can find a working solution shortly.
* David Johansson <thelist at dlade.net> wrote:
> Jon Molesa wrote:
> > My understand of XML, XSLT is limited practical experience. I've read
> > quite a bit but this is the first real reason I've ever had to try and
> > practice. The rub is that I need this to complete my taxes. I want to
> > transform the file into the same file minus the Invoices.
>
> What you want is called the Identity Transform. See
> http://www.dpawson.co.uk/xsl/sect2/identity.html for more information
> about that (and http://www.dpawson.co.uk/xsl/sect2/sect21.html for the
> rest of Dave Pawson's brilliant FAQ collected from the xsl-list at
> Mulberrytech).
>
> In your case, the XSLT would look something like this:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:gnc="http://www.gnucash.org/XML/gnc"
> xmlns:slot="http://www.gnucash.org/XML/slot"
> >
> <!-- Whenever you match any node or any attribute -->
> <xsl:template match="node()|@*">
> <!-- Copy the current node -->
> <xsl:copy>
> <!-- Including any attributes it has and any child nodes -->
> <xsl:apply-templates select="@*|node()"/>
> </xsl:copy>
> </xsl:template>
> <xsl:template match="gnc:transaction[.//slot:key]"></xsl:template>
> </xsl:stylesheet>
>
> So the first template matches on absolutely everything and copies
> whatever it finds, while the second template matches specifically on
> gnc:transaction elements with descendant slot:key elements and does nothing.
>
> HTH,
> David
>
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
--
Jon Molesa
rjmolesa at consoltec.net
if you're bored or curious
http://rjmolesa.com
More information about the thelist
mailing list