[thelist] XSLT XML output to XML

Jon Molesa rjmolesa at consoltec.net
Fri Apr 13 22:02:06 CDT 2007


Hey thanks,

The file is one that GnuCash uses.  I'm trying to remove all the
invoices from the file quickly and efficiently.  The basic structure
that I'm looking to ignore during the transform is:

<gnc:transaction version="2.0">
	some other elements

	<trn:slots>
		more elements
		<slot>
			<slot:key>gncInvoice</slot:key>
			more elements
		</slot>
		still more
	</trn:slots>
	more yet
</gnc:transaction>

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.  

I've tried many variations of what you've proposed, but no success so
far.  My understand is that I can still reference the path with a
disregard to the ns.  The name space is there when you're working with
multiple file and possibly overlapping elements/nodes. (??XPath
Guru's??).  In any case thanks.  I'm going to try what you've suggested
and keep an eye on this mailbox for other replies.
		

* Anthony Baratta <anthony at baratta.com> wrote:

> <xsl:foreach select="[some xpath to get all node you want]">
>    <xsl:if test="self::[slot:key]!='gncInvoice'">
>       [...do something here...]

maybe this is the do something?
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>

>    </xsl:if>
> </xsl:foreach>
> 

-- 
Jon Molesa
rjmolesa at consoltec.net
if you're bored or curious
http://rjmolesa.com



More information about the thelist mailing list