我能够写一个可怕的糟糕的xslt没有使用键,但它是非常缓慢和凌乱。有谁知道我会如何将下面的XML文件转换成干净的预期结果?谢谢!我怎样才能转换这个使用键
输入:
<testExecution>
<test>
<test.1/>
<test.2/>
<test.3/>
</test>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<executor>
<executor.1/>
<executor.2/>
<executor.3/>
</executor>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<invoker>
<invoker.1/>
<invoker.2/>
<invoker.3/>
</invoker>
<recipient>
<recipient.1/>
<recipient.2/>
<recipient.3/>
</recipient>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
</testExecution>
结果:
<testExecution>
<test>
<test.1/>
<test.2/>
<test.3/>
</test>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<people>
<importantPeople>
<executor>
<executor.1/>
<executor.2/>
<executor.3/>
</executor>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
</importantPeople>
<invoker>
<invoker.1/>
<invoker.2/>
<invoker.3/>
</invoker>
</people>
<recipient>
<recipient.1/>
<recipient.2/>
<recipient.3/>
</recipient>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
<comment>
<comment.1/>
<comment.2/>
<comment.3/>
</comment>
</testExecution>
好问题,+1。请参阅我的答案,了解使用和覆盖身份规则的传统XSLT解决方案,并为以下“注释”使用密钥。 – 2010-11-26 00:36:57