如果我有这样的文件: 输入file1.xml:
<schema>
<sequence>
<nodeA id="a">
<fruit id="small">
<orange id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</orange>
</fruit>
<fruit id="small">
<apple id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</apple>
</fruit>
<fruit id="medium">
<orange id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</orange>
</fruit>
</nodeA>
<nodeB id="b">
<dog id="large">
<doberman id="x" method="create">
<condition>
<color>Black</color>
</condition>
</doberman>
</dog>
</nodeB>
</sequence>
</schema>
file2.xml:
<schema>
<sequence>
<nodeA id="a">
<fruit id="small">
<melon id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</melon>
</fruit>
</nodeA>
<nodeB id="b">
<dog id="small">
<poodle id="x" method="create">
<condition>
<color>White</color>
</condition>
</poodle>
</dog>
</nodeB>
</sequence>
</schema>
经过串联: 输出:concate.xml
<schema>
<sequence>
<nodeA id="a">
<fruit id="small">
<orange id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</orange>
</fruit>
<fruit id="small">
<apple id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</apple>
</fruit>
<fruit id="medium">
<orange id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</orange>
</fruit>
<fruit id="small">
<melon id="x" method="create">
<attributes>
<color>Orange</color>
<year>2000</year>
</attributes>
</melon>
</fruit>
</nodeA>
<nodeB id="b">
<dog id="large">
<doberman id="x" method="create">
<condition>
<color>Black</color>
</condition>
</doberman>
</dog>
<dog id="small">
<poodle id="x" method="create">
<condition>
<color>White</color>
</condition>
</poodle>
</dog>
</nodeB>
</sequence>
</schema>
对于concate这将取决于该文件顺序上 ,以便在file2.xml节点将file1.xml的节点下放置(在例子可见)。 我有多达5个文件。 如何使用此实现XSL转换只,即XSLT将投入5个文件在同一时间和输出1个文件?
这是文档结构和我们做合并点:
<schema>
<sequence>
<nodeA id="a">
<fruit id="small">
<orange id="x" method="create">
...
</orange>
</fruit>
<fruit id="small">
...
</fruit>
<fruit id="large">
...
</fruit>
<!-- we merge below this -->
</nodeA>
<nodeB id="b">
<dog id="large">
<doberman id="x" method="create">
...
</doberman>
</dog>
<dog id="small">
<doberman id="x" method="create">
...
</doberman>
</dog>
<!-- we merge below this -->
</nodeB>
<somenode id="any">
...
</somenode>
</sequence>
</schema>
注意:如果不能串联只有两个文件输入将被罚款,因为它总是可以重复用于其他文件。 还有一些文件中的各个节点名(nodeA上,节点B,SomeNode等),这样的东西,可以概括需要此问题。
我们可以使用xsl1.0或2.0。
非常感谢。 约翰