Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用XSL在XML文件中添加节点_Xml_Xslt_Nodes - Fatal编程技术网

使用XSL在XML文件中添加节点

使用XSL在XML文件中添加节点,xml,xslt,nodes,Xml,Xslt,Nodes,如何使用XSL将两个XML文件合并到一个输出XML文件中? 例如,我们有 文件1: <tests> <test name="testOne"/> <test name="testTwo"/> <test name="testThree"/> <test name="testFour"/> </tests> 文件2: <tests> <test name

如何使用XSL将两个XML文件合并到一个输出XML文件中? 例如,我们有

文件1:

<tests>
     <test name="testOne"/>
     <test name="testTwo"/>
     <test name="testThree"/>
     <test name="testFour"/>
</tests>

文件2:

<tests>
     <test name="testOne"/>
     <test name="testTwo"/>
     <test name="testThree"/>
     <test name="testFour"/>
     <test name="testFive"/>
</tests>

输出文件必须是:

<tests>
 <test name="testOne"/>
 <test name="testTwo"/>
 <test name="testThree"/>
 <test name="testFour"/>
 <test name="testFive"/>
</tests>

使用相同XSL的示例2: 文件1:


文件2(之二):


输出文件:

<tests>
 <test name="testOne"/>
 <test name="testTwo"/>
 <test name="testThree"/>
 <test name="test4"/>
 <test name="testFive"/>
</tests>


对于输出文件,我需要两个xml文件中包含的所有信息。我是XSL的新手,这是一个帮助我的示例。谢谢

你试着做什么?你搜索了吗?您的示例没有透露所需操作的逻辑。我编辑了以下问题:)搜索“xslt合并”将找到多个解决方案。更多人应该了解的一个资源是DavePawson的XSLFAQ页面,位于。Dave从XSL用户的邮件列表中收集了许多最佳答案,本页包括许多XSL任务的解决方案,从基本任务到复杂任务,再到“我认为这是不可能的”。
<tests>
     <test name="testFive"/>
</tests>
<tests>
 <test name="testOne"/>
 <test name="testTwo"/>
 <test name="testThree"/>
 <test name="test4"/>
 <test name="testFive"/>
</tests>