Re: Two file problem.

Subject: Re: Two file problem.
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Sep 2000 12:44:31 +0200 (MET DST)
Dave.

> 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.

Isn't this (almost) the kind of problem that my merging tool solves?
http://www.informatik.hu-berlin.de/~obecker/XSLT/#merge

You have to modify it a little bit, since the outer elements differ
(fa != fb), but that shouldn't be a problem.

> 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.

Why do you need the node-set function?
document(file-other.xml) *is* a node-set (containing the root node)
Isn't it?

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread