【发布时间】:2013-01-26 02:43:21
【问题描述】:
我有 2 个输入 xml 文件。一个模板 xml 文件,例如
<test>
<a>0</a>
<b>0</b>
<c>0</c>
<d>0</d>
<e>0</e>
</test>
和一个数据 xml 文件,该文件指定覆盖模板 xml 中的值的值。数据 xml 文件可能不会为模板 xml 中的所有元素指定值,例如
<test>
<a>1</a>
<b>2</b>
<c>3</c>
</test>
或
<test>
<e>5</e>
</test>
最终的 xml 应该是数据 xml 在模板 xml 上的叠加。例如
<test>
<a>1</a>
<b>2</b>
<c>3</c>
<d>0</d>
<e>0</e>
</test>
或
<test>
<a>0</a>
<b>0</b>
<c>0</c>
<d>0</d>
<e>5</e>
</test>
如何用 XSLT 做到这一点?
【问题讨论】: