The general solution will still be XSLT, but you need to merge two files into one large XML first with a wrapper element (XSLT works with a single input source).
<root> <TestCaseBlock> <TestCase TestCaseID="1"> ... </TestCase> </TestCaseBlock> <TestCaseBlock> <TestCase TestCaseID="2"> ... </TestCase> </TestCaseBlock> </root>
Then just do the XSLT to match = "// TestCase" and unload all the test cases, ignoring which block of the test block they belong to.
And don't worry about performance until you try. JAva's XML API is much better than in 2003.
This is the stylesheet you need:
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <TestCaseBlock> <xsl:apply-templates/> </TestCaseBlock> </xsl:template> <xsl:template match="//TestCase"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
Tested, it works.
BTW, this XSLT was compiled and executed on this (small) example in 1 ms.
source share