Subject: Re: Two file problem. From: Eric van der Vlist <vdv@xxxxxxxxxxxx> Date: Thu, 14 Sep 2000 12:25:11 +0200 |
Hi Dave, Without using an extension, I don't see how you can do it without scanning both documents. I would do a first loop on file 1 like you've shown and a second one on file 2 with a test to handle only the elements which are not in file 1. Alternatively, but using an extension to convert a rtf into nodeset (which should not be needed any longer in 1.1), you could create a nodset with the merge of the 2 files and sort it in your for-each loop. Hope this helps. Eric "Pawson, David" wrote: > > problem. > > Two xml files > > file 1 > <fa> > <a name="a1">3</a> > <a name="a2">5</a> > <a name="a3">2</a> > <a name="new">1</a> > </fa> > > file 2 > <fb> > <a name="a1">1</a> > > <a name="a3">1</a> > <a name="a4">2</a> > </fb> > > required output > <res> > <a name="a1">4</a> > <a name="a2">5</a> > <a name="a3">3</a> > <a name="a4">2</a> > <a name="new">1</a> > </res> > I.e. I want to sum the corresponding elements to the output file. > > Issues with my present solution. > Using a <for-each> on the input document I can add, to the output > using > processor:node-set(document(file-other.xml))/fx/a[@name=current()/@name] > the value of the corresponding element from the other file. > > If I use file 1 as the main document source, I can catch those > which match in file 2, but not those unique to file 2 (<a name="new"> > in the example.) > If I use file 2 as the main document source, I can get those > which match in file 1, but will miss those which are unique to file 1. > > Can anyone suggest a method of ensuring that I capture in the output > all the <a> elements from either file, without using more extensions > if possible. I think its the cup function, but no one has come up > with this as an extension even ... or have they? > > TIA DaveP > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -- ------------------------------------------------------------------------ Eric van der Vlist Dyomedea http://dyomedea.com http://xmlfr.org http://4xt.org http://ducotede.com ------------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Two file problem., Pawson, David | Thread | Re: Two file problem., David Carlisle |
Re: XSLT V 1.1, David Carlisle | Date | xsl:for-each--stuck on very basic i, Eric Taylor |
Month |