Two file problem.

Subject: Two file problem.
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Thu, 14 Sep 2000 10:21:15 +0100
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


Current Thread