Are there nodeset functions which can add nodesets to find produce a union,
subtract to find the intersection etc?
I have two nodelists which represent files on a local and remote server and
I want to transform into a list of files to replicate
i.e.
<locallist>
<file name="file1.txt"/>
<file name="file2.txt"/>
<file name="file3.txt"/>
...
</locallist>
<remotelist>
<file name="file1.txt"/>
<file name="file2.txt"/>
<file name="file3.txt"/>
...
</remotelist>
And I want a list of all nodes from remotelist which are not in locallist.
I've done this using <xsl:if> but is there a better way?
Dave
Hi,
Are there nodeset functions which can add nodesets to find produce a union,
subtract to find the intersection etc?
I have two nodelists which represent files on a local and remote server and
I want to transform into a list of files to replicate
you can use | for the Union. Difference and Intersection techniques can
be found here:
http://www.dpawson.co.uk/xsl/sect2/muench.html#d197e74
theres a lot of good stuff on this site.
--
Rich Doughty
http://www.richdoughty.net/
<t>
<locallist>
<file name="file1.txt" />
<file name="file2.txt" />
<file name="file3.txt" />
</locallist>
<remotelist>
<file name="file1.txt" />
<file name="file2.txt" />
<file name="file3.txt" />
<file name="file4.txt" />
<file name="file5.txt" />
</remotelist>
</t>
Use:
/*/remotelist/*[not(@name = /*/locallist/*/@name)]
The above XPath expression returns the last two children elements of
"remotelist".
Hope this helped.
Cheers,
Dimitre Novatchev.
P.S. This solution was tested to be correct with the XPath Visualizer.
"Dave & Lisa" <lisaa...@ozemail.com.au> wrote in message
news:5WwT7.95639$li3.8...@ozemail.com.au...
This method only works if the nodes in the two lists are the same actual
node from the source document. In my case the remotefiles and localfiles
contain duplicate elements, but they are not the same node in the xml
document so | will return both elements.
Dave
"Rich Doughty" <ri...@dufty.karoo.co.uk> wrote in message
news:3C1EA13A...@dufty.karoo.co.uk...